From: Jonathan [EMAIL PROTECTED]
targetFolder = string.join(traverse_subpath, '/') #you will have to play with
this to get the right target folder for your app
aFolder = context.restrictedTraverse(targetFolder)
searchRes = aFolder.Catalog(some search string here)
do something with search
Yes there is a 'return 0' at the beginning.
This code always executes and works just fine,
as I've mentioned before, as long as the template is in the root
folder of the given Web site. I'm trying to put this template in a
root folder that services all the Web sites of the portal, and
- Original Message
From: Maciej Wisniowski [EMAIL PROTECTED]
So this is not because of this code. Your script
ALWAYS returns '0' and does nothing more.
Just try to remove everything after 'return 0' and see
if it changes anything or remove 'return 0' and see
what happens then.
Crap.
From: Suresh V [EMAIL PROTECTED]
1. Are you using container rather than context in your script?
2. You can pass your context as a mycontext parameter to your script.
I have this line of code in my page template for handling the 404 errors:
div align=center tal:condition=here/hasSearchEngine
I
Javier Subervi wrote:
div align=center tal:condition=here/hasSearchEngine(mycontext)
And where is mycontext defined? You will need a tal:define=mycontext
here or something.
I tested the following script with mycontext as a passed parameter:
return 0
catalog = ''
try:
catalog =
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
752
From: Jonathan [EMAIL PROTECTED]
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
From: Jonathan [EMAIL PROTECTED]
What version of zope are you running? (I am running zope 2.9.2 on a linux box).
2.7.8
I didn't put it in 'root' since root isn't automatically called. I put it in a
folder called 's' which is automatically called, then I also explicitly called
it in the URL.
Subject: [Zope] Re: Preserving Context
From: Jonathan [EMAIL PROTECTED]
What version of zope are you running? (I am running zope 2.9.2 on a linux
box).
2.7.8
I didn't put it in 'root' since root isn't automatically called. I put it in
a folder called 's' which is automatically
As far as I understand you have script (say it has id 'handle_404_scr')
that handles 404 errors in 'root' folder. In this script you have
something like:
div align=center
tal:define=mycontext here
tal:condition=here/hasSearchEngine(mycontext)
Yes? So how is this script called?
I'm
From: Jonathan [EMAIL PROTECTED]
The script routine doesn't have to be located in root. traverse_subpath is
populated using the names of all subfolders that occur after the script file
name in
the URL. So if your URL is:
http:/my.web.site/folderA/scriptA/folderB/folderC,
then scriptA will
- Original Message -
From: Javier Subervi
To: zope@zope.org
Sent: Tuesday, December 12, 2006 2:29 PM
Subject: [Zope] Re: Preserving Context
The script routine doesn't have to be located in root. traverse_subpath is
populated using the names of all subfolders that occur after
Javier Subervi wrote:
Hi;
I have a page template which I use to catch and customize 404 errors. In
that page, I call a script that offers site navigation. Since I have
several sites within a portal, I decided to move all common elements
(such as this page) to a central root location from
13 matches
Mail list logo