Package gmisclib :: Module g_encode :: Class encoder
[frames] | no frames]

Class encoder

source code

Instance Methods
 
__init__(self, allowed=None, notallowed=None, regex=None, eschar='%')
Note that there are some twiddly points in defining encoders -- the notallowed and allowed arguments need to be thought through carefully, as they are passed into the re module as part of a regular expression.
source code
 
back(self, x)
Converts back from a string containing %xx escape sequences to an unencoded string.
source code
 
fwd(self, x)
Escapes a string so it is suitable for a=v; form.
source code
Method Details

__init__(self, allowed=None, notallowed=None, regex=None, eschar='%')
(Constructor)

source code 

Note that there are some twiddly points in defining encoders -- the notallowed and allowed arguments need to be thought through carefully, as they are passed into the re module as part of a regular expression. Certain characters may give surprising results.

fwd(self, x)

source code 

Escapes a string so it is suitable for a=v; form. Nonprinting characters, along with [;#] are converted to %xx escapes (hexadecimal). Non-strings will be converted to strings with repr(), and can be fed back into the python interpreter.