Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: CMF

GenericSetup: removing objects

 

 

Zope cmf RSS feed   Index | Next | Previous | View Threaded


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


m.van.rees at zestsoftware

Feb 26, 2008, 7:29 AM

Post #2 of 2 (188 views)
Permalink
Re: GenericSetup: removing objects [In reply to]

Maurits van Rees, on 2008-02-26:
> 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:

Wichert told me to go ahead. :)

Fixed on GS trunk in rev 84270 and on branch 1.3 in rev 84271.

--
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

Zope cmf RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.