How to Add an object at the root of a zope tree
How to add an object at the root of a Zope tree even if the method has been called inside a subfolder ? I tried location=aq_parent(getattr(self, 'Control_Panel')) it returns the folder where is located the method. (I suppose that 'Control_Panel' is acquired) I tried : location=aq_parent(aq_inner(getattr(self, 'Control_Panel'))) It raises an error : 'aq_parent is not defined'. It's the same with aq_base. Is there a function returning the absolute root ? TIA Andre
D2 wrote:
How to add an object at the root of a Zope tree even if the method has been called inside a subfolder ?
I tried location=aq_parent(getattr(self, 'Control_Panel')) it returns the folder where is located the method. (I suppose that 'Control_Panel' is acquired)
I tried : location=aq_parent(aq_inner(getattr(self, 'Control_Panel'))) It raises an error : 'aq_parent is not defined'. It's the same with aq_base.
Is there a function returning the absolute root ?
Hi! Create a PythonScript at the root of your Zope-Tree with id='ServerRoot' (or something similar) with content: return container Then you can get the root of your ZopeServer with calling ServerRoot()... Cheers, Maik -- Deutsche/German Zope User Group http://www.dzug.org/
Thanks, i thought there was another solution. At initialization time, i use, -ProductContext__app to get the server root. Andre Maik Jablonski a écrit:
D2 wrote:
How to add an object at the root of a Zope tree even if the method has been called inside a subfolder ?
I tried location=aq_parent(getattr(self, 'Control_Panel')) it returns the folder where is located the method. (I suppose that 'Control_Panel' is acquired)
I tried : location=aq_parent(aq_inner(getattr(self, 'Control_Panel'))) It raises an error : 'aq_parent is not defined'. It's the same with aq_base.
Is there a function returning the absolute root ?
Hi!
Create a PythonScript at the root of your Zope-Tree with id='ServerRoot' (or something similar) with content:
return container
Then you can get the root of your ZopeServer with calling ServerRoot()...
Cheers, Maik
D2 wrote:
Thanks, i thought there was another solution. At initialization time, i use, -ProductContext__app to get the server root.
You can use (un)restrictedTraverse('/') to get the root of your Zope-Server... -mj
participants (2)
-
D2 -
Maik Jablonski