[mod_python] How isolate class attributes across requests?

Norman Tindall NormanTindall at zdisk.net
Fri Aug 18 06:07:15 EDT 2006

    As i understand mod_python one interpreter per site
    default policy, if i import somemodule
    and then change attribute of class (
    for example from
                  def someclass_method(cls,arg):
                  cls.atrib = arg
    or with
             setattr(class,'atrib_name',value) ).

    Then in all other requests to this site i will have this attribute
    of class changed (as they will run within same interpreter).

    Is there any methods to isolate class attributes across requests
    EXCEPT running interpreter per request, defining class within
    handler, writing code without class attributes?
    I mean elegant and high-speed solution.

    I bear in mind only one way out: to create instance of one (first)
    class, store desired attributes as an instance attributes,
    then spawn instances of other (second) class and they will have
    needed attrubutes not as class attributes but as instance of first
    class attributes.
    But i dont like it, isolating class attributes across request
    would be more elegant.

    By the way what is the avarage speed-drop down when using
    interpreter per request in compare with interpreter per

Best regards,
 Norman                          mailto:NormanTindall at zdisk.net

More information about the Mod_python mailing list