[mod_python] persistent, reliable globals

David Geller dg at sponsera.com
Sat Mar 13 03:49:11 EST 2004


Hi -
Thanks for the answers - really interesting discussion.

I guess to summarize, if you want/need a memory-based solution for
globals, an answer would be:
1. You can't easily do what I want with apache
2. use something else, like shared memory or pyro

I've looked at many of these more general frameworks discussed, and
still don't have an answer as to what is a good one (and so, have more
or less created a home grown one, for now). I like the idea of using
flexible templates (Cheetah has its merits, as does SimpleTAL).  Awhile
ago I used a framework called "slither" which was really simple and neat
- but relied on CGI and had its own templates which were rather minimal.
I have been tempted to port slither to mod_python and Cheetah (the folks
who wrote it claim this has been done, but the code doesn't seem to be
available).

Criteria for a framework for me:
1. simple simple SIMPLE  - some of these frameworks are great, but are
worlds onto themselves - for me, a thin layer of convenience is
preferable to being all-encompassing.  Reasons I prefer simple:
reliability, debug-ability/understandability, learning-curve, ease of
interface with existing subsystems
2. Interface to existing template systems (why reinvent the wheel?) -
preferably, both sorts: html-compatible (like SimpleTAL) for easy
wysiwyg editing , and more general (like Cheetah) for all kinds of other
things (building pages from the "inside out" piece by piece, javascript,
etc.)
3. Handle sessions (etc) in a general and flexible way (maybe the new
version of mod_python does this, I don't know...)
4. Good logging / error handling facilities
5. Easy, flexiible way of storing modules in a directory tree suitable
for the application at hand
6. Perhaps desireable but by no means necessary: ability to run with or
without mod_python. For me, this is not an issue, but for many, CGI is
still the only way to go for various reasons. And in a sense, not
*requiring* mod_python makes things a bit more general and flexible
(this of course, is very debateable)


Regards,
David


David Geller wrote:

> Hi,
>
> I would like to set a global variable (in memory) from a module. I 
> would then like to access this same global variable susequently by 
> other modules at any other time, and have the value that was set there 
> to be there (until, of course, Apache is restarted).
>
> I have tried several ways of doing this, and it doesn't seem to be 
> reliable - i.e., sometimes the global variable is set when I look at 
> it, and sometimes it is still at its original state.
>
> What am I doing wrong (or right)?
>
> Thanks!
>
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>

-- 
David Geller
Sponsera, LLC
dg at sponsera.com
www.sponsera.com
Phone: 703.532.6812
Fax: 703.532.6058






More information about the Mod_python mailing list