
m.van.rees at zestsoftware
Feb 26, 2008, 7:00 AM
Post #1 of 2
(207 views)
Permalink
|
|
GenericSetup: removing objects
|
|
Hi, Say you have for example an actions.xml like this: <object name="portal_actions" meta_type="Plone Actions Tool"> <object name="history" remove="True"/> </object> So you want to remove the history object. When you run a GS extension profile with this file twice, you get an AttributeError: at the second run the importer cannot remove this object because it was already removed. Pretty lame. Does anyone mind if I fix that so the importer just continues when the to-be-removed object is already removed? That would go like this on GS trunk: Index: utils.py =================================================================== --- utils.py (revision 84102) +++ utils.py (working copy) @@ -587,7 +587,8 @@ obj_id = str(child.getAttribute('name')) if child.hasAttribute('remove'): - parent._delObject(obj_id) + if obj_id in parent.objectIds(): + parent._delObject(obj_id) continue if obj_id not in parent.objectIds(): I have tests for this. The current behaviour is not something that is actually *wanted* by anyone, right? -- Maurits van Rees | http://maurits.vanrees.org/ Work | http://zestsoftware.nl/ "This is your day, don't let them take it away." [Barlow Girl] _______________________________________________ Zope-CMF maillist - Zope-CMF[at]lists.zope.org http://mail.zope.org/mailman/listinfo/zope-cmf See http://collector.zope.org/CMF for bug reports and feature requests
|