Package pysql :: Module pysqlconf :: Class PysqlConf
[hide private]
[frames] | no frames]

Class PysqlConf

source code

Handles configuration stuff

Instance Methods [hide private]
 
__init__(self)
Config instance creation.
source code
 
get(self, key)
Gets the value of the parameter key
source code
 
getAll(self)
Gets all defined parameters
source code
 
getDefault(self, key)
Returns the default value for a parameter.
source code
 
verify(self, key, value)
Checks if the key has correct value It does not update the value.
source code
 
set(self, key, value)
Sets the parameter « key » to « value »
source code
 
write(self)
Writes config to disk
source code
 
writeCache(self)
Writes completion list cache to disk
source code
 
writeSqlLibrary(self)
Writes user sql library to disk
source code
 
writeHistory(self)
Writes shell history to disk
source code
 
setChanged(self, state)
Indicates if config data has changed.
source code
 
isChanged(self)
Returns: change state (boolean)
source code
 
setCodec(self, codec)
Sets the host codec used to display on and read from string on terminal
source code
 
getCodec(self)
Returns: host codec used to display on and from string on terminal
source code
 
__which(self, command)
Emulates the Unix which to search if command is in the PATH Instead of which, if multiple args are given, consider it as a command line and test only the first one.
source code
 
__isReadWrite(self, filepath)
Checks if filepath is readable and writable.
source code
Class Methods [hide private]
 
getConfig(cls)
Factory for configuration instance singleton
source code
Class Variables [hide private]
  configInstance = None
Method Details [hide private]

__init__(self)
(Constructor)

source code 

Config instance creation. Read the config file

getConfig(cls)
Class Method

source code 

Factory for configuration instance singleton

Returns:
PysqlConf instance

get(self, key)

source code 

Gets the value of the parameter key

Parameters:
  • key (string) - parameter name
Returns:
str or int (if cast if possible)

getAll(self)

source code 

Gets all defined parameters

Returns:
list of (key, userValue, defaultValue)

getDefault(self, key)

source code 

Returns the default value for a parameter. If no default value is defined, return None

verify(self, key, value)

source code 

Checks if the key has correct value It does not update the value.

Parameters:
  • key - key parameter to be tested
  • value - value to be tested
Returns:
True if value is correct, else False

setChanged(self, state)

source code 

Indicates if config data has changed. This is used to detect if it is necessary to save config file to disk

isChanged(self)

source code 
Returns:
change state (boolean)

setCodec(self, codec)

source code 

Sets the host codec used to display on and read from string on terminal

Parameters:
  • codec (str) - codec name

getCodec(self)

source code 
Returns:
host codec used to display on and from string on terminal

__which(self, command)

source code 

Emulates the Unix which to search if command is in the PATH Instead of which, if multiple args are given, consider it as a command line and test only the first one. Returns the full path to command if found or None

__isReadWrite(self, filepath)

source code 

Checks if filepath is readable and writable. Returns a boolean

Parameters:
  • filepath (str) - the full path to the file
Returns:
Boolean