Getting the id of a DTML Document/Method in Python
Hi all, I'm trying to write an external method that will loop through all my DTML Documents, and return only objects that match a certain criteria (based on its id). Instead of the id, my External Method returns: [<Python Method object at 83df298>, <Python Method object at 86e9ba8>] whith the following sample code: --- def LinkGenerator(self): objlist=[] for obj in self.objectValues('DTML Document'): objlist.append(obj.id) return objlist --- If I change the self.objectValues('DTML Document') into self.objectValues('Folder'), obj.id returns the correct id: ['folder1', 'folder2', 'folder3'] I've tested a few objectValues, and as far as I can tell it is only DTML Documents and DTML Methods that does not return the id correctly. How can I get to the id of a DTML Document/Method when looping through the objectValues() ? Ultimately I want to do this: def LinkGenerator(self): import re objlist=[] for obj in self.objectValues('DTML Document'): res=re.search('^link', obj.id) if res: objlist.append(obj) return objlist And then use DTML to loop through the resulting objectlist: <dtml-in LinkGenerator> <a href="<dtml-var id>"><dtml-var title_or_id></a><br> </dtml-in> Thanks a lot, Andreas.
Andreas Pauley wrote:
Hi all,
I'm trying to write an external method that will loop through all my DTML Documents, and return only objects that match a certain criteria (based on its id).
Instead of the id, my External Method returns: [<Python Method object at 83df298>, <Python Method object at 86e9ba8>]
[snip]
I've tested a few objectValues, and as far as I can tell it is only DTML Documents and DTML Methods that does not return the id correctly.
How can I get to the id of a DTML Document/Method when looping through the objectValues() ?
[snip] try using the getId() method of the object instead of accessing the id attribute directly. Sometimes id is just a value other times it is a method. -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
Casey Duncan wrote:
try using the getId() method of the object instead of accessing the id attribute directly. Sometimes id is just a value other times it is a method.
Thanks! getId() works for Folders and DTML Documents/Methods. Are there any documentation on which methods are available for each type of object? Thanks again, Andreas.
participants (2)
-
Andreas Pauley -
Casey Duncan