Package tdi :: Module interfaces :: Class EncoderInterface
[frames] | no frames]

Class EncoderInterface

source code

object --+
         |
        EncoderInterface

Encoder Interface
Instance Methods
str
starttag(self, name, attr, closed)
Build a starttag
source code
str
endtag(self, name)
Build an endtag
source code
str
name(self, name)
Encode a name (tag or attribute name)
source code
str
attribute(self, value)
Attribute encoder
source code
str
content(self, value)
Regular text content encoder
source code
str
encode(self, value)
Character-encode a unicode string to encoding
source code
str
escape(self, value)
Escape text (scan for sequences needing escaping and escape them)
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables
str encoding
The target encoding
Properties

Inherited from object: __class__

Method Details

starttag(self, name, attr, closed)

source code 
Build a starttag
Parameters:
  • name (str) - The tag name
  • attr (iterable) - The tag attributes (((name, value), ...))
  • closed (bool) - Closed tag?
Returns: str
The starttag

endtag(self, name)

source code 
Build an endtag
Parameters:
  • name (str) - Tag name
Returns: str
The endtag

name(self, name)

source code 
Encode a name (tag or attribute name)
Parameters:
  • name (basestring) - Name
Returns: str
The encoded name

attribute(self, value)

source code 

Attribute encoder

Note that this method also needs to put quotes around the attribute (if applicable).

Parameters:
  • value (basestring) - The value to encode
Returns: str
The encoded attribute

content(self, value)

source code 
Regular text content encoder
Parameters:
  • value (basestring) - The value to encode
Returns: str
The encoded attribute

encode(self, value)

source code 
Character-encode a unicode string to encoding
Parameters:
  • value (unicode) - The value to encode
Returns: str
The encoded value

escape(self, value)

source code 
Escape text (scan for sequences needing escaping and escape them)
Parameters:
  • value (str) - The value to escape
Returns: str
The escaped value

Instance Variable Details

encoding

The target encoding
Type:
str