[Zope] folderId

Evan Simpson evan@4-am.com
Fri, 17 Sep 1999 10:25:26 -0500


Markus Jais wrote:

[snippage]

> ("parts_of_path" is a list, with the elemtents (home, wizards, spell,
> firespell)
> according to the above example)
>
> while len(parts_of_path) > 1:
>       if path_parts[0] in self.objectIds(['Folder']):
>            self = path_parts[0]
>       else:
>            self = self.manage_addFolder(path_parts[0])  #set self to the
> new folder
>       path_parts = path_parts[1:]

[snipt]

> I think the problem is the "manage_addFolder" - function.
> It returns "None", instead of the folder-Id, which I need.

You figured it out already, now take the next step :-)  Actually, you do
need some small adjustments...

for part in parts_of_path[:-1]:
    if part not in self.objectIds(['Folder']):
        self.manage_addFolder(part)
    self = getattr(self, part)

*warning*: untested code