Still need help about Product namespace
Hi, I still need help about my product needing to know its namespace... Look at the following piece of DTML Meth/Doc : <dtml-let STRING="'Hello, world !'"> <dtml-var MyProduct> </dtml-let> Right. MyProduct is my product's instance, defining the following method : def __call__ (self, REQUEST=None): if REQUEST is None: if kw: REQUEST=kw else: if hasattr(self, 'REQUEST'): REQUEST=self.REQUEST else: REQUEST={} print STRING This raises a key error. I MUST get the STRING variable from the '_' namespace, but how can I pass IMPLICITLY this namespace to my product ??? Is there a way to acquire _ ??? Many thanks, P.-J. -- If the only tool you have is a hammer, you tend to see every problem as a nail. Si le seul outil dont vous disposez est un marteau, vous avez tendance à voir chaque problème comme un clou. --Abraham Maslow
On Tue, 10 Oct 2000 10:51:09 +0200, Pierre-Julien Grizel <grizel@mouli.net> wrote:
I still need help about my product needing to know its namespace...
You also need to read the answers already provided. http://www.zope.org/Members/htrd/howto/FunctionTemplate Toby Dickenson tdickenson@geminidataloggers.com
Toby Dickenson wrote:
On Tue, 10 Oct 2000 10:51:09 +0200, Pierre-Julien Grizel <grizel@mouli.net> wrote:
I still need help about my product needing to know its namespace...
You also need to read the answers already provided.
I saw your answer and I did downloaded your program... But it still doesn't work, the dtml-let statement doesn't have any effect on the namespace the TemplateClass instance fetches. But maybe is there a different way to 'call' my product, than doing a <dtml-var> ? I double-checked that you had the same problem as me : when doing a dtml-var on a TemplateClass instance, neither client nor context are passed... Anyway, many thanks for your work, it has been useful for me understanding the TemplateDict mechanism. P.-J. -- If the only tool you have is a hammer, you tend to see every problem as a nail. Si le seul outil dont vous disposez est un marteau, vous avez tendance à voir chaque problème comme un clou. --Abraham Maslow
participants (2)
-
Pierre-Julien Grizel -
Toby Dickenson