ZClass autofilling parent ZClass properties?
I'm trying to create a ZClass that inherits from another ZClass and automatically generates some of the creation properties for the parent, including 'id'. When I try to create a instance of the child, I get: Error Type: KeyError Error Value: id Here's the interesting part of the add method: <dtml-call "REQUEST.set('id', _.string.translate(_.string.lower(REQUEST['title']), _.string.maketrans(' ', '_')))"> <dtml-call "REQUEST.set('location_type', 'url')"> <dtml-call "REQUEST.set('item_type', 'link')"> <dtml-call "REQUEST.set('format', 'html')"> <dtml-with "SiteLinkClass.createInObjectManager(REQUEST['id'], REQUEST)">
From the traceback below and various attempts to hack around the error it looks to me like Zope is using my REQUEST object to try an create the parent (SiteItemClass) before it tries to create the child (SiteLinkClass). Is this the case? If so, is it impossible for me to generate the new id this way?
With this sort of traceback: Traceback (innermost last): File /home/zope/lib/python/ZPublisher/Publish.py, line 214, in publish_module File /home/zope/lib/python/ZPublisher/Publish.py, line 179, in publish File /home/zope/lib/python/Zope/__init__.py, line 201, in zpublisher_exception_hook (Object: RoleManager) File /home/zope/lib/python/ZPublisher/Publish.py, line 165, in publish File /home/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: SiteItemClass_add) File /home/zope/lib/python/ZPublisher/Publish.py, line 102, in call_object (Object: SiteItemClass_add) File /home/zope/lib/python/OFS/DTMLMethod.py, line 145, in __call__ (Object: SiteItemClass_add) File /home/zope/lib/python/DocumentTemplate/DT_String.py, line 502, in __call__ (Object: SiteItemClass_add) File /home/zope/lib/python/DocumentTemplate/DT_With.py, line 133, in render (Object: SiteItemClass.createInObjectManager(REQUEST['id'], REQUEST)) File /home/zope/lib/python/DocumentTemplate/DT_Util.py, line 321, in eval (Object: SiteItemClass.createInObjectManager(REQUEST['id'], REQUEST)) File <string>, line 0, in ? File /home/zope/lib/python/DocumentTemplate/DT_Util.py, line 156, in careful_getitem File /home/zope/lib/python/ZPublisher/HTTPRequest.py, line 758, in __getitem__ KeyError: (see above)
participants (1)
-
Dan Pierson