[Zope-CMF] GenericSetup: removing objects
Maurits van Rees
m.van.rees at zestsoftware.nl
Tue Feb 26 10:00:14 EST 2008
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]
More information about the Zope-CMF
mailing list