Testing for how an object is called.
I have several kludge ways now that do the job but none I entirely like. How can I check for the difference between being called with <dtml-var foo> and being called from foo.com/foo ? This behavior is used for both internal and external behavior of the object. Thanks Designing the webpages of tomorrow http://webme-eng.com Designing the MMORPGS of tomorrow http://worldforge.org
I know it is in bad taste to reply to my own messages but I found what I feel is an elegant solution and figured others might need something like this at some point. In the REQUEST the PUBLISHED item contains a reference to the final object that draws to the screen. The test ends up being if self.REQUEST.PUBLISHED is self: Draw however you want if your object is the final object displaying. I used this area to draw with the object wrapped with the header and footer. else: Draw however you want when the object is included via some method like a dtml-var call. Have fun Designing the webpages of tomorrow http://webme-eng.com Designing the MMORPGS of tomorrow http://worldforge.org On Wed, 23 May 2001 kosh@aesaeion.com wrote:
I have several kludge ways now that do the job but none I entirely like. How can I check for the difference between being called with <dtml-var foo> and being called from foo.com/foo ?
This behavior is used for both internal and external behavior of the object.
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 )
I'm building my first Zope site and I plan on having most of it in a LocalFS because local files works nice with CVS, grep, Emacs and all the other stuff that I'm used to. Now I'm having problems serving dtml from a LocalFS. How do I get Zope to treat a file in a LocalFS as dtml? Is it possible? Is it a Good Thing (TM), or should forget all about it and just store everything in Data.fs. Is Data.fs the way to do things in Zope, or are there many ways to do it? -- oivvio polite cell +46 (0)709 30 40 30 / phone +46 (0)8 669 64 18 / fax +46 (0)8 84 00 18 varvsgatan 10A / s-117 29 stockholm / sweden
kosh@aesaeion.com wrote:
I have several kludge ways now that do the job but none I entirely like. How can I check for the difference between being called with <dtml-var foo> and being called from foo.com/foo ?
This behavior is used for both internal and external behavior of the object.
Thanks
Designing the webpages of tomorrow http://webme-eng.com Designing the MMORPGS of tomorrow http://worldforge.org
Here is the best way I can think of: <dtml-if expr="REQUEST.steps[-1] == document_id"> ...Then we were called from the URL... <dtml-else> ...We weren't... </dtml-if> This won't work with index_html methods or documents that are called by specifying the URL of their parent, but you could extend the expression to work in that case as well. If the thing is a python script then it would be: if context.REQUEST.steps[-1] == script.getId(): ...We were called by URL... else: ...We weren't... -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
participants (3)
-
Casey Duncan -
kosh@aesaeion.com -
oivvio polite