[Zope] Namespace within a product... (argh...)

Lalo Martins lalo@hackandroll.org
Tue, 10 Oct 2000 16:40:35 -0200


On Tue, Oct 10, 2000 at 11:56:11AM +0200, Pierre-Julien Grizel wrote:
> 
> So - I had a look at DTMLDocument.py and saw the following method :
> 
> def __call__ (self, client = None, REQUEST = {}, **kw):
> 	...
> 
> SO - I try to create this method for my product :
> 
> def __call__ (self, client = None, REQUEST = {}, **kw):
> 	print client
> 	print REQUEST
> 
> 
> and it prints :
> None
> {}
> 
> 
> It seems that in fact the DTML document doesn't actually pass _.None and
> _ to my object. WHY ??????

Evan already answered, but the short story is:

your object needs to have an attribute (it may be a class
attribute and usually is) named "isDocTemp", and this attribute
must evaluate to true. Otherwise, your object is called with no
parameters.

The relevant code is:

        if hasattr(v,'isDocTemp') and v.isDocTemp:
            v=v(None, self)
        else:
            try: v=v()
            except (AttributeError,TypeError): pass

(from DocumentTemplate/DT_Util.py:277)

[]s,
                                               |alo
                                               +----
--
          Hack and Roll  ( http://www.hackandroll.org )
            News for, uh, whatever it is that we are.


http://zope.gf.com.br/lalo           mailto:lalo@hackandroll.org
         pgp key: http://zope.gf.com.br/lalo/pessoal/pgp

Brazil of Darkness (RPG)    ---     http://zope.gf.com.br/BroDar