acquisition problem
I am trying to make an object behave like a dtml-method but with one exception. I want it to look in itself first to find the data then look around it like a dtml-method does. So lets say my ojbect is called a and it exists in the folder foo in /foo/bar/baz/a I want it to look in its own vars first for the data it needs to render the dtml then look in baz bar foo just like a dtml-method does. Mainly I need this for my dtml to html generation function. Right now I am calling it with HTML(string, globals())(self, self.REQUEST) That works for giving the behavior that a dtml-document has but not for a dtml-method type behavior at least not so far. Thanks Designing the webpages of tomorrow http://webme-eng.com Designing the MMORPGS of tomorrow http://worldforge.org
kosh@aesaeion.com wrote:
I am trying to make an object behave like a dtml-method but with one exception. I want it to look in itself first to find the data then look around it like a dtml-method does. So lets say my ojbect is called a and it exists in the folder foo in /foo/bar/baz/a I want it to look in its own vars first for the data it needs to render the dtml then look in baz bar foo just like a dtml-method does. Mainly I need this for my dtml to html generation function. Right now I am calling it with
HTML(string, globals())(self, self.REQUEST) That works for giving the behavior that a dtml-document has but not for a dtml-method type behavior at least not so far.
Thanks
Designing the webpages of tomorrow http://webme-eng.com Designing the MMORPGS of tomorrow http://worldforge.org
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
try this: context = self.this() container = self.this().aq_parent context is where the instance of your prod. lives - bernd
kosh@aesaeion.com writes:
I am trying to make an object behave like a dtml-method but with one exception. I want it to look in itself first to find the data then look around it like a dtml-method does. That is exactly how a DTML document works.
Dieter
DTML documents look at where the document is physically located while methods look around where they currently appear to be located. I need my document to look in itself and then look around like a method does. Methods act locally at any folder they inherit to and I need my doc to act the same way. Designing the webpages of tomorrow http://webme-eng.com Designing the MMORPGS of tomorrow http://worldforge.org On Thu, 28 Jun 2001, Dieter Maurer wrote:
kosh@aesaeion.com writes:
I am trying to make an object behave like a dtml-method but with one exception. I want it to look in itself first to find the data then look around it like a dtml-method does. That is exactly how a DTML document works.
Dieter
kosh@aesaeion.com writes:
DTML documents look at where the document is physically located while methods look around where they currently appear to be located. I need my document to look in itself and then look around like a method does. Methods act locally at any folder they inherit to and I need my doc to act the same way. Did you try it and it did not work?
As I understand it now, a DTML document does (almost) precisely what you want: It pushes "self.aq_explicit" onto the namespace stack. This means, it looks into itself (its properties and methods). It normally should not look into its physical parents because of the "aq_explicit". The "aq_explicit" disables automatic lookup of names in the "aq_parent". I know, that this method works only as you want it, when the DTML document is called directly from ZPublisher. If called indirectly, the document's parents are part of "aq_self" and not "aq_parent". Thus, "aq_explicit" does not prevent lookup there. If you are ready to use an external method for these indirect accesses, you can unwrap the document: def unwrapContext(obj): return getattr(obj,'aq_inner',obj) You use the result of this call as variant of the document for indirect calls. Dieter
participants (3)
-
bdorn@vup.at -
Dieter Maurer -
kosh@aesaeion.com