In your root folder you could have a script that accesses the ZCatalog which 
can be called from any subfolder and can tell where it was called from... try 
the following:  create a python script (tst) in your root folder that contains 
the following code:

return str(traverse_subpath)

then invoke this script file as followings:


(substitute your own subfolders as required)

This may get you what you are looking for.

Alternatively, if you need more control over the parameters that are getting 
sent to the script file in the root folder, then you could create a script file 
in each subfolder which calls the 'root script' with the necessary 'localized' 


  ----- Original Message ----- 
  From: Javier Subervi 
  Sent: Tuesday, December 12, 2006 11:55 AM
  Subject: [Zope] Re: Preserving Context

  From: Jonathan <[EMAIL PROTECTED]>
  From: Suresh V <[EMAIL PROTECTED]>

  >In your script you could access the catalog as follows:
  >    afolder = context.restrictedTraverse('folderA/folderB/'+someLocalFolder) 
   # pass 'someLocalFolder' as a parameter
  >    catalog = afolder.Catalog    # assuming you have named your ZCatalog 

  The problem with this, is that this script is used at the base of a portal 
with several different Web sites, therefore, the root folder of each is 

  >And where is mycontext defined? You will need a tal:define="mycontext here" 
or something.

  I added the following:

  <div align="center" 
         tal:define="mycontext here"

  ...but that didn't seem to help any:

  Error Type: KeyError
  Error Value: 'hasSearchEngine(mycontext)'

  Concerning your comment about the except, this script was written by an 
employee of mine. I'm now picking up where he left off. I cleaned it up ;)

  Want to start your own business? Learn how on Yahoo! Small Business.


  Zope maillist  -
  **   No cross posts or HTML encoding!  **
  (Related lists - )
Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to