Skip to content
Browse files

add upgrade to add responsive record to portal_registry

  • Loading branch information...
1 parent d505f94 commit 524547d5174dd6c58e242c96ee0670524de74fde @toutpt toutpt committed May 11, 2012
View
2 collective/galleria/profiles/default/metadata.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<metadata>
- <version>1020</version>
+ <version>1021</version>
<dependencies>
<dependency>profile-collective.gallery:default</dependency>
<dependency>profile-collective.configviews:default</dependency>
View
16 collective/galleria/upgrades/configure.zcml
@@ -4,19 +4,27 @@
i18n_domain="collective.galleria">
<gs:upgradeStep
+ title="Upgrade collective.galleria 1021"
+ description="Add responsive option"
+ destination="1021"
+ source="1020"
+ handler=".v10xx.upgrade_1020_to_1021"
+ profile="collective.galleria:default"/>
+
+ <gs:upgradeStep
title="rename view from galleria.html to galleria_view"
description=""
- source="1010"
destination="1020"
- handler=".v1020.upgrade"
+ source="1010"
+ handler=".v10xx.upgrade_1010_to_1020"
profile="collective.galleria:default"/>
<gs:upgradeStep
title="Upgrade collective.galleria 1010"
description=""
- source="1000"
destination="1010"
- handler=".v1010.upgrade"
+ source="1000"
+ handler=".v10xx.upgrade_1000_to_1010"
profile="collective.galleria:default"/>
</configure>
View
12 collective/galleria/upgrades/v1010/__init__.py
@@ -1,12 +0,0 @@
-from Products.CMFCore.utils import getToolByName
-
-PROFILE = 'profile-collective.galleria:default'
-
-def upgrade(context):
-
- context.runImportStepFromProfile(PROFILE, 'browserlayer')
- context.runImportStepFromProfile(PROFILE, 'plone.app.registry')
- jsregistry = getToolByName(context, 'portal_javascripts')
- cssregistry = getToolByName(context, 'portal_css')
- jsregistry.unregisterResource('++resource++collective.galleria.classic.js')
- cssregistry.unregisterResource('++resource++collective.galleria.classic.css')
View
23 collective/galleria/upgrades/v1020/__init__.py
@@ -1,23 +0,0 @@
-from Products.CMFCore.utils import getToolByName
-
-PROFILE = 'profile-collective.galleria:default'
-
-def upgrade(context):
- site = context.aq_parent
- catalog = getToolByName(site, 'portal_catalog')
- types = ('Folder','Topic','Link')
-
- for portal_type in types:
- brains = catalog(portal_type=portal_type)
-
- for brain in brains:
- ob = brain.getObject()
- layout = ob.getLayout()
-
- if layout == 'galleria.html':
- ob.setLayout('galleria_view')
-
- setup = getToolByName(site, 'portal_setup')
- setup.runImportStepFromProfile('profile-collective.galleria:default',
- 'typeinfo', run_dependencies=False,
- purge_old=False)
View
48 collective/galleria/upgrades/v10xx.py
@@ -0,0 +1,48 @@
+from zope import component
+from Products.CMFCore.utils import getToolByName
+
+from plone.registry.interfaces import IRegistry
+from plone.registry.record import Record
+from plone.registry import field
+from collective.galleria import i18n
+
+PROFILE = 'profile-collective.galleria:default'
+
+def upgrade_1020_to_1021(context):
+ registry = component.getUtility(IRegistry)
+ record = Record(field.Bool(title=i18n.responsive,
+ description=i18n.responsive_desc,),
+ False)
+ rid ='collective.galleria.interfaces.settings.IGalleriaSettings.responsive'
+ registry.records[rid] = record
+
+def upgrade_1010_to_1020(context):
+
+ site = context.aq_parent
+ catalog = getToolByName(site, 'portal_catalog')
+ types = ('Folder','Topic','Link')
+
+ for portal_type in types:
+ brains = catalog(portal_type=portal_type)
+
+ for brain in brains:
+ ob = brain.getObject()
+ layout = ob.getLayout()
+
+ if layout == 'galleria.html':
+ ob.setLayout('galleria_view')
+
+ setup = getToolByName(site, 'portal_setup')
+ setup.runImportStepFromProfile('profile-collective.galleria:default',
+ 'typeinfo', run_dependencies=False,
+ purge_old=False)
+
+
+def upgrade_1000_to_1010(context):
+
+ context.runImportStepFromProfile(PROFILE, 'browserlayer')
+ context.runImportStepFromProfile(PROFILE, 'plone.app.registry')
+ jsregistry = getToolByName(context, 'portal_javascripts')
+ cssregistry = getToolByName(context, 'portal_css')
+ jsregistry.unregisterResource('++resource++collective.galleria.classic.js')
+ cssregistry.unregisterResource('++resource++collective.galleria.classic.css')

0 comments on commit 524547d

Please sign in to comment.
Something went wrong with that request. Please try again.