[Zope] namespace acquisition in product methods

Guido A.J. Stevens gyst@nfg.nl
27 Feb 2000 14:33:11 +0100


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

	def namespace(self):
		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]