[commits] r143 - selinux-site/trunk/selinux.policy/selinux/policy
tim at mail.se.linux.org
tim at mail.se.linux.org
Ons Nov 28 11:47:25 CET 2007
Author: tim
Date: 2007-11-28 11:47:24 +0100 (Wed, 28 Nov 2007)
New Revision: 143
Modified:
selinux-site/trunk/selinux.policy/selinux/policy/content.py
Log:
Now all content is created correctly. This should be refactored to a new dev package as initial content creation should only happen during development. On production we should create content manually. It's no big deal, it's just a few folders.
Modified: selinux-site/trunk/selinux.policy/selinux/policy/content.py
===================================================================
--- selinux-site/trunk/selinux.policy/selinux/policy/content.py 2007-11-26 21:17:59 UTC (rev 142)
+++ selinux-site/trunk/selinux.policy/selinux/policy/content.py 2007-11-28 10:47:24 UTC (rev 143)
@@ -3,6 +3,7 @@
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.utils import _createObjectByType
from Products.ATContentTypes.lib import constraintypes
+from Testing import makerequest
def createContent(site):
createNewsFolder(site)
@@ -89,7 +90,7 @@
# return
# News topic
- folder.invokeFactory('Topic', id='aggregator', title='Händelser')
+ folder.invokeFactory('Topic', id='aggregator', title='Nyheter')
folder = site.nyheter
folder.setConstrainTypesMode(constraintypes.ENABLED)
folder.setLocallyAllowedTypes(['News Item'])
@@ -119,19 +120,33 @@
def createSimpleFolders(site):
workflow = getToolByName(site, 'portal_workflow')
- folders = ({'id': 'grupper', 'title': 'Arbetsgrupper'},
- {'id': 'dokument', 'title': 'Dokumentation'},
- {'id': 'om', 'title': 'Om föreningen'},
- {'id': 'support', 'title': 'Support'},
- {'id': 'chat', 'title': 'Chat'},
- {'id': 'nyborjare', 'title': 'Nybörjare'})
+ # this is a little hack, when we create a HelpCenter the context
+ # must have a request, otherwise an error is raised
+ site2 = makerequest.makerequest(site)
+ folders = ({'id': 'grupper', 'title': 'Arbetsgrupper',
+ 'portal_type': 'Folder', 'wfaction': 'publish'},
+ {'id': 'dokument', 'title': 'Dokumentation',
+ 'portal_type': 'HelpCenter', 'wfaction': None},
+ {'id': 'om', 'title': 'Om föreningen',
+ 'portal_type': 'Folder', 'wfaction': 'publish'},
+ {'id': 'support', 'title': 'Support',
+ 'portal_type': 'Folder', 'wfaction': 'publish'},
+ {'id': 'chat', 'title': 'Chat',
+ 'portal_type': 'Folder', 'wfaction': 'publish'},
+ {'id': 'nyborjare', 'title': 'Nybörjare',
+ 'portal_type': 'Folder', 'wfaction': 'publish'})
+
for folderinfo in folders:
folder_id = folderinfo['id']
title = folderinfo['title']
- folder = getattr(site, folder_id, None)
+ portal_type = folderinfo['portal_type']
+ action = folderinfo['wfaction']
+ folder = getattr(site2, folder_id, None)
+
if folder is None:
- newid = site.invokeFactory('Large Plone Folder', id=folder_id, title=title)
- folder = getattr(site, newid)
- workflow.doActionFor(folder, 'publish')
+ newid = site2.invokeFactory(portal_type, id=folder_id, title=title)
+ folder = getattr(site2, newid)
+ if action:
+ workflow.doActionFor(folder, action)
folder.indexObject()
More information about the commits
mailing list