[Zope-CMF] Member preferences

yuppie y.2010 at wcm-solutions.de
Thu Jul 1 03:33:50 EDT 2010


Hi!


Charlie Clark wrote:
> _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>

No need to reset the title of the 'user' category. That's not the 
purpose of your upgrade step.

The tests just make sure an unmodified site is upgraded correctly. But 
usually sites are customized. And if someone uses category titles he 
would not expect that your step deletes them.

[...]
> 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.

And that error shows you a nice diff that tells you that the 
change_password action is added, but in the wrong position. Right? Or 
did you forget to register the upgrade step?

> Do I need to tell the upgrade to do the insert before preferences?

Yes. "environ._should_purge = False" gives you the extension profile 
behavior. By default new objects are added to the end of the container. 
If you want them in a different place, you have to specify that using an 
update directive ('insert-before' or 'insert-after').


Cheers,

	Yuppie


More information about the Zope-CMF mailing list