[Zope] Re: Preserving Context

2006-12-12 Thread Javier Subervi
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: I changed it thus: I tested the followin

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

[Zope] Get a reference to the latest transaction

2006-12-12 Thread Peter Bengtsson
Is it possible? If so, how do I get a reference to the last/current transaction that just happened within a method? Pseudo code: class MyFolder(Folder): def manage_afterAdd(self): self.image_count = 0 def addImage(self, imgdata, REQUEST): self.manage_addImage('someid', f

Re: [Zope] Get a reference to the latest transaction

2006-12-12 Thread Jonathan
- Original Message - From: "Peter Bengtsson" <[EMAIL PROTECTED]> To: "Zope Generic List" Sent: Tuesday, December 12, 2006 9:51 AM Subject: [Zope] Get a reference to the latest transaction Is it possible? If so, how do I get a reference to the last/current transaction that just happe

Re: [Zope] Get a reference to the latest transaction

2006-12-12 Thread Peter Bengtsson
that doesn't get a particular transaction, it gets all the latest ones. If I use that approach, how do I know that I get my particular transaction and not some other concurrent one? On 12/12/06, Jonathan <[EMAIL PROTECTED]> wrote: - Original Message - From: "Peter Bengtsson" <[EMAIL PRO

Re: [Zope] Get a reference to the latest transaction

2006-12-12 Thread Jonathan
- Original Message - From: "Peter Bengtsson" <[EMAIL PROTECTED]> To: "Jonathan" <[EMAIL PROTECTED]> Cc: "Zope Generic List" Sent: Tuesday, December 12, 2006 10:11 AM Subject: Re: [Zope] Get a reference to the latest transaction that doesn't get a particular transaction, it gets all

[Zope] Re: Preserving Context

2006-12-12 Thread Suresh V
Javier Subervi wrote: 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 = getattr(mycontext, mycontext.superValues('ZCatalog')[0].id) ex

[Zope] Re: Preserving Context

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

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

[Zope] Re: Preserving Context

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

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

[Zope] Re: Preserving Context

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

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 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): --

[Zope] Re: Preserving Context

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

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

[Zope] Zeo question

2006-12-12 Thread ian
Hi, Hope you can help 1. I am having trouble connecting a zope client to a zeo database.The server and client are in different goegraphical locations and behind different proxies and firewalls. I read that they communicate using a 'custom RPC protocol'...what does this mean and does it have any

Re: [Zope] Zeo question

2006-12-12 Thread Maciej Wisniowski
> 2. I can create a custom skin on each zope (in reality plone) instance > right or is each zope instance is just a mirror of the other? Nope. It is something different. In general ZEO is about sharing ZODB (Zope Object Database) between few Zope instances. There is no mirroring but just one ZODB.

Re: [Zope] Zeo question

2006-12-12 Thread Jonathan
- Original Message - From: "Maciej Wisniowski" <[EMAIL PROTECTED]> To: "ian" <[EMAIL PROTECTED]> Cc: Sent: Tuesday, December 12, 2006 4:00 PM Subject: Re: [Zope] Zeo question 2. I can create a custom skin on each zope (in reality plone) instance right or is each zope instance is jus

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

[Zope] tal conditional help

2006-12-12 Thread David Bear
I have a page template that tag to insert another template. currently I do form template I rely on the form.pt object to exist in the folder where the template is called from. This works okay. However, I think it would be wise to put some kind of error checking in the tal to avoid sending s

Re: [Zope] tal conditional help

2006-12-12 Thread Bernd Dorn
On 12.12.2006, at 22:57, David Bear wrote: I have a page template that tag to insert another template. currently I do form template use the or operator it also catches errors form template ___ Zope maillist - Zope@zope.org http://

[Zope] if object does not exist in python

2006-12-12 Thread David Bear
Can anyone show me code examples of a script that checks for the existences of a named object? -- David Bear phone: 602-496-0424 fax:602-496-0955 College of Public Programs/ASU University Center Rm 622 411 N Central Phoenix, AZ 85007-0685 "Beware the IP portfolio, everyone will be suspect

Re: [Zope] if object does not exist in python

2006-12-12 Thread Andrew Milton
+---[ David Bear ]-- | Can anyone show me code examples of a script that checks for the | existences of a named object? if namedObject in container.objectIds(): # object exists else: # doesn't Checks for named object inside the container that the script is in. -- An