[mod_python] global data in psp_/python.

Ole Jacob Hagen waterthrill at yahoo.no
Wed Aug 11 21:15:23 EDT 2004


Hi.

Is it possible to use Cookies to "simulate" real global data, as you
find in extern C?
I know static global data's is not a good solution to my problem, though....

If I had implemented an application in C++, I would have used singleton
pattern, and so on, but Python is not C++, I'm afraid.

Any suggestions to my problem?

Thanx in advance for helping me out.

Cheers,

Ole J.


Ole Jacob Hagen wrote:

> Hi.
>
> I am having a intricate problem....
> I am using psp, and my configuration is right...
>
> I am using two frames, an upper frame and one lower frame.
> I will describe a simple example:
>
> ----------------------------------------------------------------------------- 
>
> quasi-code:
>
> upper_frame:
> 1. form, input="textfield" name=data, should be a number.
> 2. input="submit"
>
>
> lower_frame:
> 1. initialize NUMBER=0 if NUMBER is not initialised
> 2. req.write("%s = %s + %s" %(NUMBER+upper_frame.data, NUMBER, 
> upper_frame.data))
> 3. set NUMBER = NUMBER+upper_frame.data to be used next time
>
> example of usage:
> 1. number in textfield in  upper_frame = 10, and click submit
> 2. lower_frame will receive and add NUMBER and upper_frame.data (which 
> is received from POST). The number 10 is the answer.
> 3. New value of NUMBER is stored.
> 4. number in textfield in  upper_frame = 15, and click submit
> 5. lower_frame will receive and add NUMBER and upper_frame.data (which 
> is received from POST).
> 6. NUMBER = 10 fram the last addition, and NUMBER+upper_frame.data = 25
> 7. set NUMBER = NUMBER+upper_frame.data to be used next time.
>
> ----------------------------------------------------------------
>
> My question is how can I implement the lower_frame?
> I mean; How can I handle the NUMBER-variable?
> Is it possible, at all?
>
>
> Cheers,
>
> Ole J.
>
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>




More information about the Mod_python mailing list