[Zope] creating objects in python

Michel Vayssade michel.vayssade@utc.fr
Wed, 24 Oct 2001 14:47:18 +0200 (MET DST)


Hi,

In the constructor of a python product I put this code, I copied
out of the doc :
def addInstance(dispatcher, id, REQUEST=None):
    """ Create instance  """
    p=FILclass(id)
    dispatcher.Destination()._setObject(id, p)

It works.
Then from that code I "guessed" I could use it as this :

	# create an instance of another class 
	u1 = Uclass('xxxx')
	# put u1 at the same level as "self"
	dispatcher.Destination()._setObject('xxx', u1)

        # create another instance of another class
	u2 = Uclass('yyyy')
	# put u2 inside folder "foldyy"
	getattr(dispatcher.Destination(),'foldyy')._setObject('yyyy', u2)

ALL that code works fine. !!!!!!!!

So what ?
I would like to understand WHY it works.

Can a zope guru explain :
	- what is this magic object dispatcher ?
	- I "guess" dispatcher.Destination() is something like PARENT[x]
	  is it ?
	- is there other usefull functions applicable to dispatcher ?
	- Is this documented somewhere ?

Thanks

--
  _/   _/ _/_/_/  _/_/ Michel.Vayssade@UTC.fr    Service Informatique
 _/   _/   _/  _/      T:33/0-3.44.23.49.24 Universite de Technologie
_/   _/   _/  _/       F:33/0-3.44.23.46.77 BP 20.529 60205 Compiegne
 _/_/    _/    _/_/    _ mv@utc.fr __/www.utc.fr/~vayssade____ France