[Zope-CMF] Member preferences
Charlie Clark
charlie.clark at clark-consulting.eu
Wed Jun 30 12:11:08 EDT 2010
Am 30.06.2010, 15:26 Uhr, schrieb yuppie <y.2010 at wcm-solutions.de>:
> See check_actions_tool/upgrade_actions_tool in to21.py.
I'm afraid I haven't quite got the hang of this. I've added the check and
upgrade:
_ACTIONS_XML = """\
<?xml version="1.0"?>
<object name="portal_actions" meta_type="CMF Actions Tool"
xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<object name="user" meta_type="CMF Action Category">
<property name="title"></property>
<object name="change_password" meta_type="CMF Action"
i18n:domain="cmf_default">
<property name="title" i18n:translate="">Change password</property>
<property name="description"
i18n:translate="">Change your password</property>
<property name="url_expr">string:${portal_url}/password_form</property>
<property name="link_target"></property>
<property
name="icon_expr">string:${portal_url}/preferences_icon.png</property>
<property name="available_expr">member</property>
<property name="permissions">
<element value="Set own password"/>
</property>
<property name="visible">True</property>
</object>
</object>
</object>
def check_actions_tool(tool):
"""2.2.x to 2.3.0 upgrade step checker
"""
atool = getToolByName(tool, 'portal_actions')
try:
atool.user.change_password
except AttributeError:
return True
return False
def upgrade_actions_tool(tool):
"""2.2.x to 2.3.0 upgrade step handler
"""
logger = logging.getLogger('GenericSetup.upgrade')
atool = getToolByName(tool, 'portal_actions')
environ = SetupEnviron()
environ._should_purge = False
getMultiAdapter((atool, environ), IBody).body = _ACTIONS_XML
logger.info("'change_password' action added.")
But if change the actions.xml I still get the error when I run the tests.
Do I need to tell the upgrade to do the insert before preferences?
Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
More information about the Zope-CMF
mailing list