Package Gnumed :: Package pycommon :: Module gmCfg :: Class cCfgSQL |
[frames] | no frames]

# Class cCfgSQL

source code

Instance Methods
__init__(self) | source code
get(self, option=None, workplace=None, cookie=None, bias=None, default=None, sql_return_type=None) | source code
get2(self, option=None, workplace=None, cookie=None, bias=None, default=None, sql_return_type=None) Retrieve configuration option from backend. | source code
getID(self, workplace=None, cookie=None, option=None) Get config value from database. | source code
set(self, workplace=None, cookie=None, option=None, value=None) Set (insert or update) option value in database. | source code
getAllParams(self, user=None, workplace=`'``xxxDEFAULTxxx``'`) Get names of all stored parameters for a given workplace/(user)/cookie-key. | source code
delete(self, conn=None, pk_option=None) | source code
delete_old(self, workplace=None, cookie=None, option=None) Deletes an option or a whole group. | source code

Method Details

### get2(self, option=None, workplace=None, cookie=None, bias=None, default=None, sql_return_type=None) | source code
    Retrieve configuration option from backend.

    @param bias: Determine the direction into which to look for config options.

            'user': When no value is found for "current_user/workplace" look for a value
                    for "current_user" regardless of workspace. The corresponding concept is:

                    "Did *I* set this option anywhere on this site ? If so, reuse the value."

            'workplace': When no value is found for "current_user/workplace" look for a value
                    for "workplace" regardless of user. The corresponding concept is:

                    "Did anyone set this option for *this workplace* ? If so, reuse that value."

    @param default: if no value is found for the option this value is returned
            instead, also the option is set to this value in the backend, if <None>
            a missing option will NOT be created in the backend
    @param sql_return_type: a PostgreSQL type the value of the option is to be
            cast to before returning, if None no cast will be applied, you will
            want to make sure that sql_return_type and type(default) are compatible

### getID(self, workplace=None, cookie=None, option=None) | source code
    Get config value from database.

    - unset arguments are assumed to mean database defaults except for <cookie>

### set(self, workplace=None, cookie=None, option=None, value=None) | source code
Set (insert or update) option value in database. Any parameter that is None will be set to the database default. Note: you can't change the type of a parameter once it has been created in the backend. If you want to change the type you will have to delete the parameter and recreate it using the new type.

### getAllParams(self, user=None, workplace=`'``xxxDEFAULTxxx``'`) | source code
Get names of all stored parameters for a given workplace/(user)/cookie-key. This will be used by the ConfigEditor object to create a parameter tree.

### delete_old(self, workplace=None, cookie=None, option=None) | source code
Deletes an option or a whole group. Note you have to call store() in order to save the changes.