Package Pyblosxom :: Module tools :: Class Replacer
[hide private]
[frames] | no frames]

Class Replacer

source code

Class for replacing variables in a template

This class is a utility class used to provide a bound method to the re.sub() function. Gotten from OPAGCGI.

Instance Methods [hide private]
 
__init__(self, request, encoding, var_dict)
Its only duty is to populate itself with the replacement dictionary passed.
source code
string
replace(self, matchobj)
The replacement method.
source code
Method Details [hide private]

__init__(self, request, encoding, var_dict)
(Constructor)

source code 
Its only duty is to populate itself with the replacement dictionary passed.
Parameters:
  • request (Request) - the Request object
  • encoding (string) - the encoding to use
  • var_dict (dict) - The dict for variable substitution

replace(self, matchobj)

source code 

The replacement method.

This is passed a match object by re.sub(), which it uses to index the replacement dictionary and find the replacement string.
Parameters:
  • matchobj (re object) - A re object containing substitutions
Returns: string
Substitutions