Module gmCfg
source code
GNUmed configuration handling.
This source of configuration information is supported:
Theory of operation:
It is helpful to have a solid log target set up before importing this
module in your code. This way you will be able to see even those log
messages generated during module import.
Once your software has established database connectivity you can set
up a config source from the database. You can limit the option
applicability by the constraints "workplace", "user",
and "cookie".
The basic API for handling items is get()/set(). The database config
objects auto-sync with the backend.
Copyright:
GPL v2 or later
Author:
Karsten Hilbert <Karsten.Hilbert@gmx.net>
|
|
|
getDBParam(workplace=None,
cookie=None,
option=None)
Convenience function to get config value from database. |
source code
|
|
|
setDBParam(workplace=None,
user=None,
cookie=None,
option=None,
value=None)
Convenience function to store config values in database. |
source code
|
|
|
cfg_DEFAULT = ' xxxDEFAULTxxx '
|
|
__package__ = ' Gnumed.pycommon '
|
Imports:
sys,
types,
cPickle,
decimal,
logging,
regex,
gmPG2,
gmTools
getDBParam(workplace=None,
cookie=None,
option=None)
| source code
|
Convenience function to get config value from database.
will search for context dependant match in this order:
-
CURRENT_USER_CURRENT_WORKPLACE
-
CURRENT_USER_DEFAULT_WORKPLACE
-
DEFAULT_USER_CURRENT_WORKPLACE
-
DEFAULT_USER_DEFAULT_WORKPLACE
We assume that the config tables are found on service
"default". That way we can handle the db connection inside this
function.
Returns (value, set) of first match.
|
setDBParam(workplace=None,
user=None,
cookie=None,
option=None,
value=None)
| source code
|
Convenience function to store config values in database.
We assume that the config tables are found on service "default".
That way we can handle the db connection inside this function.
Omitting any parameter (or setting to None) will store database defaults for it.
- returns True/False
|