[Zope] Problems with adding ZClass instances
John Morton
jwm@plain.co.nz
Mon, 27 Mar 2000 16:29:30 +1200 (NZST)
I'm have problems with a ZClass I'm working on that uses Folder as
it's base class and is supposed to install a set of default methods
when it's created. The trouble is that it won't when the webDirectory
is created, but it will when I invoke the same method from a tab afterwards.
Here's the body of webDirectory_add:
<dtml-with "webDirectory.createInObjectManager(REQUEST['id'], REQUEST)">
<dtml-if createDefaultMethods>
<dtml-in "default_methods.objectIds()">
<dtml-try>
<dtml-call "manage_delObjects(ids=[_['sequence-item']])">
<dtml-except>
</dtml-try>
<dtml-call "manage_clone(
_.getattr(default_methods, _['sequence-item']),
_['sequence-item'], REQUEST)">
</dtml-in>
</dtml-if>
</dtml-with>
I'm assuming that the code within the <dtml-with ...> is effectively
opperating in the context of the newly created object, but when the
first manage_clone() is executed, it bombs out in _getCopy,
tripping over on this line:
ob=container._p_jar.importFile(f)
...because whatever container is, it's not a folderish object.
So what do I need to do to switch to the new webDirectory object at
creation time, so adding methods is automatic?
Thanks,
John.