Re: Local class variables? (mod_python problem)

2007-02-23 Thread Diez B. Roggisch
It is not desirable for the class variable to keep incrementing outside of invocations of '__main__', as is the case when it is loaded under mod_python under apache2 on linux. I'm still not clear on what you want to accomplish. In the end it boils down to who is supposed to share that

Re: Local class variables? (mod_python problem)

2007-02-23 Thread Rory Campbell-Lange
On 23/02/07, Diez B. Roggisch ([EMAIL PROTECTED]) wrote: It is not desirable for the class variable to keep incrementing outside of invocations of '__main__', as is the case when it is loaded under mod_python under apache2 on linux. I'm still not clear on what you want to accomplish.

Re: Local class variables? (mod_python problem)

2007-02-23 Thread Diez B. Roggisch
Many thanks for your reply. The use case is per request, and I would be grateful to learn more about thread-local storage. There are several ways. I'm not familiar with mod_python, but I guess you get a dict-like object for the request parameters. In python, this is usually writable (in

Local class variables? (mod_python problem)

2007-02-22 Thread Rory Campbell-Lange
We have a set of classes using static methods to retain reference variables between operations. The problem is that the static variables are not reset between operations when used through mod_python. Although it is possible to reset the class variables between invocations of the system, this has

Re: Local class variables? (mod_python problem)

2007-02-22 Thread Piet van Oostrum
Rory Campbell-Lange [EMAIL PROTECTED] (RC) wrote: RC We have a set of classes using static methods to retain reference RC variables between operations. The problem is that the static variables RC are not reset between operations when used through mod_python. RC Although it is possible to reset

Re: Local class variables? (mod_python problem)

2007-02-22 Thread Diez B. Roggisch
Rory Campbell-Lange wrote: We have a set of classes using static methods to retain reference variables between operations. The problem is that the static variables are not reset between operations when used through mod_python. Although it is possible to reset the class variables between

Re: Local class variables? (mod_python problem)

2007-02-22 Thread Rory Campbell-Lange
Apologies to Piet and Diez for the lack of clarity in my previous post (and the broken code). In essence we use class variables as follows: class Part (object): totalgia = 0 def __init__(self, gia): self.gia = gia # gross internal area self.giaratio =

Re: Local class variables? (mod_python problem)

2007-02-22 Thread Piet van Oostrum
Rory Campbell-Lange [EMAIL PROTECTED] (RC) wrote: RC totalgia keeps incrementing when this code is used under mod_python. And also when used outside of mod_python. It is because it is a class level variable. In fact I think under certain circumstances in mod_python it will not do that because

Re: Local class variables? (mod_python problem)

2007-02-22 Thread Rory Campbell-Lange
On 22/02/07, Rory Campbell-Lange ([EMAIL PROTECTED]) wrote: In essence we use class variables as follows: class Part (object): totalgia = 0 def __init__(self, gia): self.gia = gia # gross internal area self.giaratio = 0

Re: Local class variables? (mod_python problem)

2007-02-22 Thread greg
Rory Campbell-Lange wrote: class Part (object): totalgia = 0 def __init__(self, gia): self.gia = gia # gross internal area self.giaratio = 0 Part.totalgia += self.gia if __name__ == '__main__': p1 = Part(20)