Changeset 3159 in products
- Timestamp:
- Apr 20, 2011 10:39:13 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ploneorg.kudobounty/trunk/ploneorg/kudobounty/setuphandlers.py
r3158 r3159 42 42 wftool.doActionFor(topic, 'publish') 43 43 44 logger.info("Bounty submissions aggregator successfully added") 45 44 logger.info("Bounty submissions aggregator added") 45 else: 46 logger.info("Bounty submissions aggregator already exist at %s" % \ 47 topic.absolute_url()) 46 48 47 49 def createPFGForm(context, container, wftool, logger): … … 49 51 """ 50 52 form = getattr(container, FORM_ID, None) 51 if form is not None: 52 container.manage_delObjects(ids = FORM_ID) 53 # Create new form object 54 container.invokeFactory(id=FORM_ID, type_name="FormFolder", 55 title="Bounty Submission Form") 56 form = getattr(container, FORM_ID) 57 # cleanup form and import data from the archive 58 form.manage_delObjects(ids=form.objectIds()) 59 pfg_data = context.readDataFile("submissions-form.tar.gz") 60 ctx = TarballImportContext(form, pfg_data) 61 IFilesystemImporter(form).import_(ctx, 'structure', True) 62 # Fix importing PFG via GS bug 63 # - it adds extra indentation, wchich breaks the script. 64 create_bounty_script = form["create-bounty-submission"] 65 create_bounty_script.setScriptBody(CREATE_SCRIPT_BODY) 66 # Update and pubhish the form 67 form.update(**{"actionAdapter":["create-bounty-submission",],}) 68 form.unmarkCreationFlag() 69 form.reindexObject() 70 if wftool.getInfoFor(form, 'review_state') != 'published': 71 wftool.doActionFor(form, 'publish') 72 logger.info("Bounty submission form successfully created") 53 if form is None: 54 container.invokeFactory(id=FORM_ID, type_name="FormFolder", 55 title="Bounty Submission Form") 56 form = getattr(container, FORM_ID) 57 # cleanup form and import data from the archive 58 form.manage_delObjects(ids=form.objectIds()) 59 pfg_data = context.readDataFile("submissions-form.tar.gz") 60 ctx = TarballImportContext(form, pfg_data) 61 IFilesystemImporter(form).import_(ctx, 'structure', True) 62 # Fix importing PFG via GS bug 63 # - it adds extra indentation, wchich breaks the script. 64 create_bounty_script = form["create-bounty-submission"] 65 create_bounty_script.setScriptBody(CREATE_SCRIPT_BODY) 66 # Update and pubhish the form 67 form.update(**{"actionAdapter":["create-bounty-submission",],}) 68 form.unmarkCreationFlag() 69 form.reindexObject() 70 if wftool.getInfoFor(form, 'review_state') != 'published': 71 wftool.doActionFor(form, 'publish') 72 logger.info("Bounty submission form created") 73 else: 74 logger.info("Bounty submissions form already exist at %s" % \ 75 form.absolute_url()) 73 76 74 77 def createStructure(context, logger): … … 77 80 78 81 # CONTAINER 79 if CONTAINER_ID not in site.objectIds(): 82 folder = getattr(site, CONTAINER_ID, None) 83 if folder is None: 80 84 _createObjectByType('Folder', site, id=CONTAINER_ID, 81 85 title=CONTAINER_TITLE) … … 92 96 93 97 logger.info("Submissions container added") 98 else: 99 logger.info("Submissions container already exist at %s" % \ 100 folder.absolute_url()) 94 101 95 102 createTopic(folder, wftool, logger)
Note: See TracChangeset
for help on using the changeset viewer.