Hello Zopers! I need to write a global variable into my Zope project but I don't know how to do it. HELP!!!! RicardoP
Global variable? Where? In what? My guess is that session variables may be what you want -- check out the Zope Book for details. On Wed, 27 Aug 2003 rpenatez@lattice.com.co wrote:
Hello Zopers! I need to write a global variable into my Zope project but I don't know how to do it. HELP!!!! RicardoP
_______________________________________________ Zope maillist - Zope@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 )
On Wed, 2003-08-27 at 15:26, rpenatez@lattice.com.co wrote:
Hello Zopers! I need to write a global variable into my Zope project but I don't know how to do it. HELP!!!!
Ok, here is how I did it, whether it was a good idea or not is left as an exercise for the reader :^P Go to top level folder for website in ZMI, click Properties, and add the name and value for your global. You can then reference it from within the entire site (thanks to Zope's acquisition). Any other/better ways to do this? -- Mitch
On Wednesday 27 August 2003 02:26 pm, rpenatez@lattice.com.co wrote:
Hello Zopers! I need to write a global variable into my Zope project but I don't know how to do it. HELP!!!! RicardoP
There's really no such thing as a global variable! In the context of a single executable, we mean "in the scope of the whole executable program in a given instance or invocation of the program". That seems obvious when programming a simple executable program. But for a web application, the situation is more complex. Which scope or lifetime should the variable have? Is it a property of the object/instance in the ZODB? Is it a property of a "session" with a particular user? Is it a property of the entire web application on a given server? Is it a per-server property? Is it a per-page property? Is it a per-user property? Is it a property of the particular release of your product? Or your site? Perhaps it should even apply to all server running the program in the entire world (which would be truly "global"). Where you put the variable will depend on which of these many possibilities you meant. Some of the places I have put variables that are "global" in one of these various ways: * MySQL database field, keyed to the user * Property of a high-level folder * Defined in an imported Config.py file in the product * Class attribute of a particular kind of Zope object * Stored in the REQUEST or in an HTML "POST" web form in a hidden form Cheers, Terry -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com
What exactly do you mean by a ' global variable '? On Wed, 2003-08-27 at 14:26, rpenatez@lattice.com.co wrote:
Hello Zopers! I need to write a global variable into my Zope project but I don't know how to do it. HELP!!!! RicardoP
_______________________________________________ Zope maillist - Zope@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 ) -- Edward Muller
Interlix (http://www.interlix.com) Phone: 417-862-0573 - Cell: 417-844-2435 - Fax: 417-862-0572 Web Hosting - PC Service & Support - Custom Programming - Network Service & Support Specializing in Open Source Solutions
participants (6)
-
Chris Withers -
Dennis Allison -
Edward Muller -
Mitch Pirtle -
rpenatez@lattice.com.co -
Terry Hancock