managing properties/configurations

Venkatraman.S. venkat83 at gmail.com
Thu May 15 23:39:06 EDT 2008


Hi,

Am sure many would have stumbled on this situation while developing an
application in Python which is highly driven by configuration/
properties.

I have an application (obviously written in Python) wherein the
properties change frequently and the program needs to work according
to the new rules. Since , python is scripting language the idea of a
Properties file(analogous to Java) doesnt make sense to me. However,
at the same time i am looking for some mechanism by which the hot-
patches(i.e, properties can be changed) can be applied easily.

Since the patches(mostly properties change) will be mostly be done by
non-programmers, i do not want them to touch the Py codes,but at the
same time alter the behaviour suitably.(Kindly avoid the advice to
teach Python to the non-programmers :D ).

The following is a *very simple example* of the case wherein the
properties(namely 10,30,31,40) are 'hardcoded' - i want this to be
'away' from the code.

def checkCutoff(self,up,down):
       .............do some processing........
       if (10 <= score <= 30):
       		result="Bad"
       elif (31 <= score <= 40):
       		result="Good"
       .............do some processing........
       return result

If i have to have this as a separate script that stores all the
properties, then how do I make the program fetch the new values
without restarting.

Also, i would be interested in providing a GUI for manging the
properties so that the changes can be applied even more easily - but
at any time i do not want to bring down the program and then
restart(all are hot patches).

Regards,
Venkat



More information about the Python-list mailing list