[Zope] Global Variables
Small Business Services
toolkit at magma.ca
Tue Jan 20 11:27:16 EST 2004
Use property fields on a folder (all routines can access these variables -
given the correct security settings).
Some useful code bits:
1) create a new property on a folder:
<dtml-call "temp_folder.manage_addProperty('newtestpropvar', 'initial
contents', 'string')">
you can then access the property field just like a normal REQUEST variable:
eg. <dtml-var newtestpropvar>
note: this code chunk uses the 'temp_folder' folder which is a folder stored
in RAM and any content stored in this folder will disappear if zope is
stopped/restarted. If you do not want to lose your content, use a regular
folder.
2) check to see if property exists on a given folder:
<dtml-call "REQUEST.set('ownerid', 'testpropvar')">
<dtml-if "temp_folder.getProperty(ownerid, 'none') != 'none'">
<dtml-var ownerid> exists<br>
<dtml-else>
<dtml-var ownerid> does not exist<br>
</dtml-if>
Jonathan
----- Original Message -----
From: "Asad Habib" <ahabib at engin.umich.edu>
To: <zope at zope.org>
Sent: January 20, 2004 11:13 AM
Subject: [Zope] Global Variables
> Is there a way to declare a global variable in Zope? And is there a way to
> declare a variable that is available for an entire session? Any help would
> be greatly appreciated. Thanks.
>
> - Asad
>
>
> _______________________________________________
> 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 )
More information about the Zope
mailing list