Hi, I have a strange problem with my ZClass. We have built a layout system, where pages (a ZClass) contain components (another ZClass) of different types (header, text...); the code for adding, changing and displaying the components is stored in templates (which are DTML Methods and _not_ part of the component object but stored in an ordinary, acquisited folder). However, since I condensed the code to simply tell each component to render itself, I get an error when I try to modify the component via the interface. I tracked it down to common.manage_changeProperties, which throws an AttributeError, error value: getOwner. Base classes of the component ZClass: ZObject, CatalogAwareBase, ZObjectManager Python method 'render': ## Script (Python) "render" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title=gibt das gerenderte Template zurück ## from Products.PythonScripts.standard import DTML request = context.REQUEST response = request.RESPONSE print '<!-- Methode: render (acComponent %s; DEBUG) ... -->' % \ container.title_and_id() the_template = container.getTemplate() myDTML = DTML(the_template.document_src()) request.componentTree.append(container) print myDTML(context, request, response) request.componentTree.pop() print '<!-- ... Methode: render (acComponent %s; DEBUG) -->' % \ container.title_and_id() return printed ## The End Method getTemplate: ## Script (Python) "getTemplate" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title=gibt das Template-Objekt zurück ## # das Template-Objekt zurückgeben (die DTML-Methode): return context.aq_parent.components_[container.template] ## The End Any ideas? Thanks a lot, Tobias . . . . . . . . . . . . . . . . . . . . . . . . .
THerp@apriori.de writes:
... However, since I condensed the code to simply tell each component to render itself, I get an error when I try to modify the component via the interface. I tracked it down to common.manage_changeProperties, which throws an AttributeError, error value: getOwner. ... from Products.PythonScripts.standard import DTML ... myDTML = DTML(the_template.document_src()) ... print myDTML(context, request, response) I fear, this stopped working with Zope 2.2.
The object "DTML" returns does (apparently) not have an owner. Since Zope 2.2, an owner is essential to protect against Trojan horses (read the Zope 2.2 security documentation). Dieter
participants (2)
-
Dieter Maurer -
THerp@apriori.de