[Checkins] SVN: gzo.plonepolicy/trunk/gzo/plonepolicy/ adjust the
default portlets
Kevin Teague
kevin at bud.ca
Mon Nov 12 04:02:35 EST 2007
Log message for revision 81763:
adjust the default portlets
Changed:
A gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/gzo.portlet_config.txt
U gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/import_steps.xml
U gzo.plonepolicy/trunk/gzo/plonepolicy/setuphandlers.py
-=-
Added: gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/gzo.portlet_config.txt
===================================================================
Modified: gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/import_steps.xml
===================================================================
--- gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/import_steps.xml 2007-11-12 08:56:06 UTC (rev 81762)
+++ gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/import_steps.xml 2007-11-12 09:02:29 UTC (rev 81763)
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
<import-steps>
- <import-step id="gzo-various" version="20071103-01"
- handler="gzo.plonepolicy.setuphandlers.importVarious"
- title="Additional Grok site policy setup">
- Grok site policy
+ <import-step id="gzo-portlets" version="20071105-01"
+ handler="gzo.plonepolicy.setuphandlers.assignPortlets"
+ title="Portlet Assignment">
+ Grok Portlets policy
</import-step>
</import-steps>
Modified: gzo.plonepolicy/trunk/gzo/plonepolicy/setuphandlers.py
===================================================================
--- gzo.plonepolicy/trunk/gzo/plonepolicy/setuphandlers.py 2007-11-12 08:56:06 UTC (rev 81762)
+++ gzo.plonepolicy/trunk/gzo/plonepolicy/setuphandlers.py 2007-11-12 09:02:29 UTC (rev 81763)
@@ -1,14 +1,36 @@
-def importVarious(context):
- """Miscellanous steps import handle
- """
-
- # Ordinarily, GenericSetup handlers check for the existence of XML files.
- # Here, we are not parsing an XML file, but we use this text file as a
- # flag to check that we actually meant for this import step to be run.
- # The file is found in profiles/default.
-
- if context.readDataFile('gzo.policy_various.txt') is None:
+from zope.component import getUtility
+from zope.component import getMultiAdapter
+
+from plone.portlets.interfaces import IPortletAssignmentMapping
+from plone.portlets.interfaces import IPortletManager
+from plone.portlets.interfaces import IPortletType
+
+from plone.app.portlets import portlets
+
+def assignPortlets(context):
+ "Portlet Assignment"
+
+ if context.readDataFile('gzo.portlet_config.txt') is None:
return
portal = context.getSite()
+
+ leftColumn = getUtility(IPortletManager, name=u'plone.leftcolumn', context=portal)
+ rightColumn = getUtility(IPortletManager, name=u'plone.rightcolumn', context=portal)
+ left = getMultiAdapter((portal, leftColumn,), IPortletAssignmentMapping, context=portal)
+ right = getMultiAdapter((portal, rightColumn,), IPortletAssignmentMapping, context=portal)
+
+ # delete stock portlets
+ for key in left.keys():
+ # keep navigation
+ if key == u'navigation':
+ continue
+ del left[key]
+ for key in right.keys():
+ del right[key]
+
+ left[u'top'] = portlets.classic.Assignment('portlet_leftcolumntop','portlet')
+ left[u'news'] = portlets.classic.Assignment('portlet_news','portlet')
+ left[u'download'] = portlets.classic.Assignment('portlet_download','portlet')
+
More information about the Checkins
mailing list