<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<STYLE type=text/css>DIV {
        MARGIN: 0px
}
</STYLE>

<META content="MSHTML 6.00.5730.11" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>In your root folder you could have a script that 
accesses the ZCatalog&nbsp;which can be called from any subfolder and can tell 
where it was called from... try the following:&nbsp; create a python script 
(tst) in your root folder that contains the following code:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>return str(traverse_subpath)<BR></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>then invoke this script file as 
followings:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>http:/your.web.site/tst</FONT></DIV>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>http:/your.web.site/tst/folderA</FONT></DIV>
<DIV>
<DIV><FONT face=Arial 
size=2>http:/your.web.site/tst/folderB/folderC</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>(substitute your own subfolders as required)</DIV>
<DIV>&nbsp;</DIV>
<DIV>This may get you what you are looking for.</DIV>
<DIV>&nbsp;</DIV>
<DIV>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' parameters.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Jonathan</DIV></DIV></DIV></FONT>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=javier_subervi@yahoo.com 
  href="mailto:javier_subervi@yahoo.com">Javier Subervi</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=zope@zope.org 
  href="mailto:zope@zope.org">zope@zope.org</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, December 12, 2006 11:55 
  AM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> [Zope] Re: Preserving 
  Context</DIV>
  <DIV><BR></DIV>
  <DIV 
  style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
  <DIV>From: Jonathan &lt;dev101@...&gt;<BR>&amp;&amp;<BR>From: Suresh V 
  &lt;suresh_vv@...&gt;<BR><BR>&gt;In your script you could access the catalog 
  as follows:<BR>&gt; <BR>&gt;&nbsp;&nbsp;&nbsp; afolder = 
  context.restrictedTraverse('folderA/folderB/'+someLocalFolder)&nbsp;&nbsp;&nbsp; 
  # pass 'someLocalFolder' as a parameter<BR>&gt;&nbsp;&nbsp;&nbsp; catalog = 
  afolder.Catalog&nbsp;&nbsp;&nbsp; # assuming you have named your ZCatalog 
  'Catalog'<BR><BR>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 different.<BR><BR>&gt;And where is mycontext defined? You will need 
  a tal:define="mycontext here" or something.<BR><BR>I added the 
  following:<BR><BR>&lt;div align="center" 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tal:define="mycontext 
  here"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  tal:condition="here/hasSearchEngine(mycontext)"&gt;<BR><BR>...but that didn't 
  seem to help any:<BR><BR>Error Type: KeyError<BR>Error Value: 
  'hasSearchEngine(mycontext)'<BR><BR>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 ;)<BR>TIA,<BR>Javier<BR></DIV></DIV><BR>
  <HR SIZE=1>
  Want to start your own business? Learn how on <A 
  href="http://us.rd.yahoo.com/evt=41244/*http://smallbusiness.yahoo.com/r-index">Yahoo! 
  Small Business.</A>
  <P>
  <HR>

  <P></P>_______________________________________________<BR>Zope maillist&nbsp; 
  -&nbsp; 
  Zope@zope.org<BR>http://mail.zope.org/mailman/listinfo/zope<BR>**&nbsp;&nbsp; 
  No cross posts or HTML encoding!&nbsp; **<BR>(Related lists - 
  <BR>&nbsp;http://mail.zope.org/mailman/listinfo/zope-announce<BR>&nbsp;http://mail.zope.org/mailman/listinfo/zope-dev 
  )<BR></BLOCKQUOTE></BODY></HTML>