[Zope] namespace acquisition in product methods
Michel Pelletier
michel@digicool.com
Sun, 27 Feb 2000 07:39:14 -0800
"Guido A.J. Stevens" wrote:
>
> Hi,
>
> I'm writing a product and am starting from 'boring'. Immediately I'm
> running into namespace problems :-(....
>
> Basically, I modified the boring product only slightly:
>
> def __init__(self, id, title='', REQUEST=None):
> """initialise a new instance of NFG_SiteMap"""
> self.id = id
> self.title = title
> self.REQUEST=REQUEST
eek! Don't hold onto the REQUEST object. Allways use the one provided
to you on each request.
>
> def namespace(self):
Make this def namespace(self, REQUEST)
> return "%s" % (self.REQUEST)
>
> That is, I'm trying to test my access to the REQUEST parameters by
> calling a <dtml-var namespace> in the index_html dtml document.
> For the rest, the boring product setup is intact, inheritance etc. unchanged.
>
> Something very interesting happens:
> - when I add a new instance to the root folder of my zope
> installation, this works as intended. Index_html prints out lots of
> interesting environment.
> - when I add a new instance to a sub folder:
> * the management tabs disappear
> * the REQUEST appears to be 'None'
> - when I copy the working root folder instance into the subfolder,
> that copy functions normally with management tabs and REQUEST info.
>
> What am I missing here? Why do the class instances behave differently
> if they're in the same location, but created in different locations?
>
> :*CU#
> --
> *** Guido A.J. Stevens *** mailto:gyst@nfg.nl ***
> *** Net Facilities Group *** tel:+31.43.3618933 ***
> *** http://www.nfg.nl *** fax:+31.43.3560502 ***
>
> Perhaps the deeper one probes and the greater one's commitment
> to, and dependence on, information technology, the more resistant
> one may become to its essence.
> [Coyne, ISBN 0-262-03228-7, p.315]
>
> _______________________________________________
> 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 )