class variable persistence question
Hi, I am writing a custom user folder. In the product I have a config.py file that has a number of parameters defined that are used all over the place by other classes. These parameters specify some global variables, that I would like to set when a new instance of the product is created. If these parameters are preset then there is no problem at all, but that makes my product a bit inflexible. If I could set them when the product is instantiated, that would be great. Can I set these parameters in the manage_add method and expect them to persist for the life of the instance?? If not is there a work around for a situation like this?? TIA AM -- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
AM writes:
I am writing a custom user folder. In the product I have a config.py file that has a number of parameters defined that are used all over the place by other classes. These parameters specify some global variables, that I would like to set when a new instance of the product is created.
If these parameters are preset then there is no problem at all, but that makes my product a bit inflexible. If I could set them when the product is instantiated, that would be great.
Can I set these parameters in the manage_add method and expect them to persist for the life of the instance?? When you put them in the instance, you can.
When you put them in the class, they are not persistent but live only during the process' lifetime.
If not is there a work around for a situation like this?? I would read the configuration file during product import and populate the class with the values read.
Dieter
participants (2)
-
AM -
Dieter Maurer