Re: [Zope] Re: Preserving Context

2006-12-13 Thread Javier Subervi
- 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

Re: [Zope] Re: Preserving Context

2006-12-13 Thread Maciej Wisniowski
> > 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

Re: [Zope] Re: Preserving Context

2006-12-13 Thread Javier Subervi
- Original Message From: Maciej Wisniowski [EMAIL PROTECTED] >There is 'return 0' at the beginning, or it is a mistake? >If it is 'return 0' then the code below it is never executed... Yes there is a 'return 0' at the beginning. This code always executes and works just fine, as I've me

Re: [Zope] Re: Preserving Context

2006-12-13 Thread Maciej Wisniowski
> I'm confused. I had a programmer working for me that wrote the > following code: > > > > return 0 > > catalog = '' > > try: > > catalog = getattr(context, context.superValues('ZCatalog')[0].id) > > except AttributeError: > > pass > > if catalog: > > return 1 > There is 'return 0' at th

Re: [Zope] Re: Preserving Context

2006-12-12 Thread Javier Subervi
- Original Message From: Maciej Wisniowski <[EMAIL PROTECTED]> >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: > tal:define="mycontext here" > tal:condition="here/hasSe

Re: [Zope] Re: Preserving Context

2006-12-12 Thread Jonathan
>- 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 aft

Re: [Zope] Re: Preserving Context

2006-12-12 Thread Maciej Wisniowski
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: Yes? So how is this script called? I'm not sure what exactly is your case but you may try: or just (without passing a parameter): --

Re: [Zope] Re: Preserving Context

2006-12-12 Thread Jonathan
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 receive a traverse_subpath variable

Re: [Zope] Re: Preserving Context

2006-12-12 Thread Jonathan
traverse_subpath works for me just fine. if you placed the 'tst' python script in your root folder (and this script contains the line "return str(traverse_subpath)" ) you should get: http:/your.web.site/tst -> should return an empty list [] http:/your.web.site/tst/folderA -> should retu

Re: [Zope] Re: Preserving Context

2006-12-12 Thread Jonathan
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 invok

Re: [Zope] Re: Preserving Context

2006-12-12 Thread Jonathan
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 'Catalog' Note: If this script is accessing a