From: Michael D. <svn...@pl...> - 2008-08-05 20:23:45
|
Author: davismr Date: Tue Aug 5 20:23:35 2008 New Revision: 69524 Modified: PloneSurvey/trunk/content/Survey.py PloneSurvey/trunk/content/configure.zcml Log: Convert survey to use an event handler Modified: PloneSurvey/trunk/content/Survey.py ============================================================================== --- PloneSurvey/trunk/content/Survey.py (original) +++ PloneSurvey/trunk/content/Survey.py Tue Aug 5 20:23:35 2008 @@ -52,9 +52,6 @@ """Remove all respondents.""" self.respondents = OOBTree() - def at_post_create_script(self): - self.createLocalPas() - security.declarePrivate('createLocalPas') def createLocalPas(self): """Create PAS acl_users else login_form does not work""" @@ -731,3 +728,8 @@ return False registerATCT(Survey, PROJECTNAME) + +def createSurveyEventHandler(ob, event): + """Initialise the survey""" + if not 'acl_users' in ob.objectIds(): + ob.createLocalPas() Modified: PloneSurvey/trunk/content/configure.zcml ============================================================================== --- PloneSurvey/trunk/content/configure.zcml (original) +++ PloneSurvey/trunk/content/configure.zcml Tue Aug 5 20:23:35 2008 @@ -1,18 +1,26 @@ -<configure xmlns="http://namespaces.zope.org/five"> +<configure + xmlns="http://namespaces.zope.org/zope" + xmlns:browser="http://namespaces.zope.org/browser" + xmlns:five="http://namespaces.zope.org/five"> - <deprecatedManageAddDelete + <five:deprecatedManageAddDelete class=".Survey.Survey" /> - <deprecatedManageAddDelete + <five:deprecatedManageAddDelete class=".SubSurvey.SubSurvey" /> - <deprecatedManageAddDelete + <five:deprecatedManageAddDelete class=".BaseQuestion.BaseQuestion" /> - <deprecatedManageAddDelete + <five:deprecatedManageAddDelete class=".SurveyMatrix.SurveyMatrix" /> - <deprecatedManageAddDelete + <five:deprecatedManageAddDelete class=".SurveyMatrixQuestion.SurveyMatrixQuestion" /> - <deprecatedManageAddDelete + <five:deprecatedManageAddDelete class=".SurveySelectQuestion.SurveySelectQuestion" /> - <deprecatedManageAddDelete + <five:deprecatedManageAddDelete class=".SurveyTextQuestion.SurveyTextQuestion" /> + <subscriber + for="Products.PloneSurvey.content.Survey.Survey + zope.app.event.interfaces.IObjectModifiedEvent" + handler="Products.PloneSurvey.content.Survey.createSurveyEventHandler" /> + </configure> |