Base class for all classes, that uses option from configfile.
If one option is valid, the attribute is created with the value of the validate function.
Parameters: |
|
---|
Loads configuration into object.
Parameters: | cfg (dict) – The Configuration dict. Normally you use configParser.items("section"). |
---|
Options collections.OrderedDict for Options used in configuration file (see iro.config.Option). Ordering of configuration fields are done by order.
Sample:
OrderedDict([
("dburl",Option(lambda x,y:x,long="Connection URL to database",must=True)),
("port",Option(partial(vInteger,minv=0),long="Port under that twisted is running",must=True)),
])
A child class typically use update to add more options.
Bases: ConfigParser.ConfigParser
Configparser that also validate configfile.
It is possile to restiger function, that are called, when config file is reloaded
One Option in the configuration file
Parameters: |
|
---|
Configfile list
configParser to get configuration.
Main config options
options for main section
Read the configuration and update all registered object (see MyConfigParser.reload_()).
Bases: exceptions.Exception
Exception while loading configuration.
Bases: iro.error.InterfaceException
950 – error in external api
Bases: exceptions.Exception
Exception, that should be reported to external client
999 – unknown error
Parameters: |
|
---|
Bases: iro.error.ValidateException
702 – invalid mailaddress
Bases: iro.error.ValidateException
701 – invalid telnumber
Bases: iro.error.InterfaceException
902 – jobid is unknown
Bases: iro.error.ConfigException
Option is missing, but needed.
Bases: iro.error.OfferException
no provider found
Bases: iro.error.OfferException
no valid route found
Bases: exceptions.Exception
Can’t send message to recipient with given offers
Bases: iro.error.OfferException
no typ found.
Bases: exceptions.Exception
an Exception in Offer handling
Bases: exceptions.Exception
can’t handle the recipient in a route
Bases: iro.error.ConfigException
Option is unknown
Bases: iro.error.InterfaceException
901 – apikey is unknown – user not found
Checks, if database can be connected.
Returns: | boolean value |
---|
A telefonnumer, with splitted country part
Parameters: | number (string) – a telefonnumber |
---|
Return the Hash for telefonnumbers.
Yust use the hash of the string representation of the Number
String representation of the telefonnumber.
Returns: | the international telefonnumber with leading zeros |
---|
Split string into two parts: one country part and the rest.
For a local number std_land will be used for country part.
Parameters: | number (string) – a telefonnumber |
---|
Country part of a telefonnumber
Localpart of the telefonnumber
Regex for country part
Regex for numbers
Regex for a complete telefon number
Standard country part
Validate function for boolean values
Returns: | value |
---|---|
Raises : | iro.error.ValidateException |
validator for emailadresses (see wikipeda for strange mailadresses and RFC3696)
valid:
not valid:
Parameters: |
|
---|---|
Returns: | value |
Raises : |
validate function for float values.
Parameters: |
|
---|---|
Returns: | value |
Raises : |
see also :func:vNumber
Validate function for hash values
Parameters: |
|
---|---|
Returns: | value |
Raises : |
validate function for integer values.
Parameters: |
|
---|---|
Returns: | value |
Raises : |
see also :func:vNumber
validate function for integer values.
Parameters: |
|
---|---|
Returns: | value |
Raises : |
Validator for telefon numbers :return: value :raises: iro.error.InvalidTel
validate decorator.
Parameters: |
|
---|---|
Params args: | arguments for validate function |
Params kargs: | keyword arguments for validate function |
Note
this decorator can handle function that returns a defer object.
use it like this:
@validate(kwd=userhash, func=vuserhash)
f(userhash)
that will validate userhash with the function vuserhash. Every validate function should raise an Exception, if the the value is not valid. All args and kargs are used to call the validate function. if need is True, the kwd can’t be None.