A rule conversion object.
An object of this class, provided a fw_*_converter dictionary,
can translate the value of a single XML attribute or a full DOM.
Methods
|
|
__init__
addSection
convertDom
convertString
setSections
|
|
__init__
|
__init__ ( self )
|
|
addSection
|
addSection (
self,
c,
d,
)
Add a single set of option translations.
Exceptions
|
|
RuleConverterError( 'addSection() requires a' + ' string/tuple and a dictionary' )
RuleConverterError( 'the dictionary must contains' + ' a tuple with 2 items as values' )
|
|
|
convertDom
|
convertDom ( self, opt )
Convert a whole XML rule.
Given a DOM, return a DOM with all attribute values converted.
|
|
convertString
|
convertString (
self,
opt,
val='',
section='',
)
Convert an attribute.
Given an attribute name (e.g. fragment-only ), an optional
value (e.g. no ) and an optional section (e.g. rule ) a string
useful to build the command is returned (e.g. ! --fragment ).
Exceptions
|
|
RuleConverterError( 'for an option marked as' + ' BOOLEAN the value must be one of yes, no, ignore' )
|
|
|
setSections
|
setSections ( self, d )
Take as argument a dictionary like fw_*_converter.
Set the dictionary used for translations.
Exceptions
|
|
RuleConverterError( 'setSections() requires a dictionary' )
|
|
|