[ZDP] BackTalk to Document The Zope Book (2.5 Edition)/Advanced Zope Scripting

webmaster@zope.org webmaster@zope.org
Tue, 12 Nov 2002 22:56:55 -0500


A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/current/ScriptingZope.stx#3-20

---------------

      Let's follow along as Zope traverses the URL
      *Zoo/Vet/LargeAnimals/hippo/vaccinate*. Zope starts in the root
      folder and looks for an object named *Zoo*. It moves to the
      *Zoo* folder and looks for an object named *Vet*. It moves to
      the *Vet* folder and looks for an object named
      *LargeAnimals*. The *Vet* folder doesn't contain an object with
      that name, but it can acquire the *LargeAnimals* folder from its
      container, *Zoo* folder. So it moves to the *LargeAnimals*
      folder and looks for an object named *hippo*.  It then moves to
      the *hippo* object and looks for an object named
      *vaccinate*. Since the *hippo* object does not contain a
      *vaccinate* object and neither do any of its containers, Zope
      backtracks along the URL path trying to find a *vaccinate*
      object. First it backs up to the *LargeAnimals* folder where
      *vaccinate* still can't be found. Then it backs up to the *Vet*
      folder.  Here it finds a *vaccinate* script in the *Vet*
      folder. Since Zope has now come to the end of the URL, it calls
      the *vaccinate* script in the context of the *hippo* object.

        % Anonymous User - Sep. 26, 2002 5:58 pm:
         if i understood correctly (the book by spicklemire/friedly/spicklemire/brand)
         http://www.zopeonarope.com/Misc/chapters8-10.pdf page 199-211,
         i have to place "Vet" somewhere in the url, but not necessarily right after "Zoo".
         Acquisition comes into play, when "Vet" acquires "LargeAnimals".
         But this whole example still doesnt let me infer a rule, so i cannot generalize, which is bad, since the
         websites i do are not zoos.
         But clearly, the given URL is not the physical path to 1 zope object,
         but contains locations 2 objects, Zoo/LargeAnimals/hippo and Zoo/Vet/vaccinate.
         explain more, please. blf

        % Anonymous User - Nov. 12, 2002 10:56 pm:
         What if instead I wish to restrict the script to be called only by its current container/folder? i.e. I only
         allow 'Vet' to call 'vaccinate' and not other folders. TIA, newbie here:) - jy