Hi, I have some code that is suppose to delete DC.* properties from all objects that can contain properties in a folder. Right now it's generating an error. See for yourself by taking out the try and except statements. The next step is to generalize this so that is can recursively go through the site. The code is as follows: <dtml-var standard_html_header> <dtml-call "REQUEST.set('DcList',['DC.title','DC.things','DC.happy','DC.Tuesday'])"> <dtml-in objectValues> <dtml-let currentObject=sequence-var-id> <dtml-in propertyItems> <dtml-let currentProperty=sequence-key> <dtml-if expr="_.string.split(currentProperty,'.')[0]=='DC'"> Delete property: <dtml-var currentProperty><br> <dtml-try> <dtml-call expr="manage_delProperties(currentProperty)"> <dtml-except> </dtml-try> </dtml-if> </dtml-let> </dtml-in> </dtml-let> <br> </dtml-in> <dtml-var standard_html_footer> Thanks in advance... kevin kkuo@umich.edu
See for yourself by taking out the try and except statements.
No thanks, thats too much work. But if you tell me what the error is and provide a traceback we might be able to help. Cheers. -- Andy McKay. ----- Original Message ----- From: "Kevin Kuo" <kkuo@engin.umich.edu> To: <zope@zope.org> Sent: Wednesday, July 11, 2001 2:29 PM Subject: [Zope] manage_delProperties woes
Hi, I have some code that is suppose to delete DC.* properties from all objects that can contain properties in a folder. Right now it's generating an error. See for yourself by taking out the try and except statements. The next step is to generalize this so that is can recursively go through the site.
The code is as follows:
<dtml-var standard_html_header>
<dtml-call "REQUEST.set('DcList',['DC.title','DC.things','DC.happy','DC.Tuesday'])">
<dtml-in objectValues> <dtml-let currentObject=sequence-var-id> <dtml-in propertyItems> <dtml-let currentProperty=sequence-key>
<dtml-if expr="_.string.split(currentProperty,'.')[0]=='DC'">
Delete property: <dtml-var currentProperty><br> <dtml-try> <dtml-call expr="manage_delProperties(currentProperty)"> <dtml-except> </dtml-try> </dtml-if> </dtml-let> </dtml-in> </dtml-let> <br> </dtml-in>
<dtml-var standard_html_footer>
Thanks in advance... kevin kkuo@umich.edu
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Kevin Kuo writes:
... Right now it's generating an error. ... <dtml-call expr="manage_delProperties(currentProperty)"> The method is called "manage_delProperties", i.e. it uses a plural.
It wants a sequence of ids not a single id. Dieter
<dtml-call expr="manage_delProperties(currentProperty)">
The method is called "manage_delProperties", i.e. it uses a plural.
It wants a sequence of ids not a single id.
Dieter
Then, wouldn't this be in contrast of what the Zope Book says? I see under manage_delProperties([ids, REQUEST]) the following text explanation: "Delete one or more properties specified by ids." Therefore, wouldn't providing ONE id be in agreement with this statement? How is one to only delete a single property? Tommy Innovation: The Best Way To Predict The Future ... Is To Create It.
Tommy Johnson wrote:
<dtml-call expr="manage_delProperties(currentProperty)">
The method is called "manage_delProperties", i.e. it uses a plural.
It wants a sequence of ids not a single id.
Dieter
Then, wouldn't this be in contrast of what the Zope Book says? I see under manage_delProperties([ids, REQUEST]) the following text explanation: "Delete one or more properties specified by ids."
Therefore, wouldn't providing ONE id be in agreement with this statement? How is one to only delete a single property?
Tommy
Pass it a one items list as in: manage_delObjects([someid]) -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
participants (5)
-
Andy McKay -
Casey Duncan -
Dieter Maurer -
Kevin Kuo -
Tommy Johnson