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
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.
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
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
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
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
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 =
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
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
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)
10 matches
Mail list logo