[Zope] Re: Preserving Context
Jonathan
dev101 at magma.ca
Tue Dec 12 09:21:11 EST 2006
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 folder & catalog that is outside of the scope of the permissioned user (ie. not in the path that that user has permissions for), you will need to set a proxy role on the script
hth
Jonathan
----- Original Message -----
From: Javier Subervi
To: zope at zope.org
Sent: Tuesday, December 12, 2006 8:57 AM
Subject: [Zope] Re: Preserving Context
From: Suresh V <suresh_vv at ...>
>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 changed it thus:
<div align="center" tal:condition="here/hasSearchEngine(mycontext)">
I tested the following script with "mycontext" as a passed parameter:
return 0
catalog = ''
try:
catalog = getattr(mycontext, mycontext.superValues('ZCatalog')[0].id)
except:
pass
if catalog:
return 1
This threw an error concerning "mycontext".
TIA,
Javier
------------------------------------------------------------------------------
Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates.
------------------------------------------------------------------------------
_______________________________________________
Zope maillist - Zope at zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20061212/48dea61c/attachment.htm
More information about the Zope
mailing list