Package pyamf :: Class BaseEncoder

[hide private]
[frames] | no frames]

# Class BaseEncoder

source code

Base AMF encoder.

Instance Methods | [hide private]

__init__(self, data=None, context=None, strict=False) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code

writeFunc(self, obj) Not possible to encode functions. | source code

callable or `None`.

_getWriteElementFunc(self, data) Gets a function used to encode the data. | source code

callable or `None`.

_writeElementFunc(self, data) Gets a function used to encode the data. | source code

writeElement(self, data) Writes the data. | source code

Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Instance Variables | [hide private]

`type` or `types.ClassType` | context_class Holds the class that will create context objects for the implementing `Encoder`.
`list` | type_map = ``[``]`` A list of types -> functions.
An instance of `BaseEncoder.context_class` | context The context for the encoding.
BufferedByteStream | stream The underlying data stream.
`bool`, default is False. | strict Whether the encoder should operate in 'strict' mode.

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, data=None, context=None, strict=False)
(Constructor)

source code

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  - `data` (BufferedByteStream) - Data stream.
  - `context` (Context) - Context.
Raises:
  - `TypeError` - The `context` parameter must be of type Context.
Overrides: object.__init__

### writeFunc(self, obj)

source code

Not possible to encode functions.

Raises:
  - `EncodeError` - Unable to encode function/methods.

### _getWriteElementFunc(self, data)

source code

Gets a function used to encode the data.

Parameters:
  - `data` (`mixed`) - Python data.
Returns: callable or `None`.
  The function used to encode data to the stream.

### _writeElementFunc(self, data)

source code

Gets a function used to encode the data.

Parameters:
  - `data` (`mixed`) - Python data.
Returns: callable or `None`.
  The function used to encode data to the stream.

### writeElement(self, data)

source code

Writes the data. Overridden in subclass.

Parameters:
  - `data` (`mixed`) - The data to be encoded to the data stream.

Instance Variable Details | [hide private]

### context_class

Holds the class that will create context objects for the implementing `Encoder`.

Type:
  `type` or `types.ClassType`

Value:
  pyamf.BaseContext

### type_map

A list of types -> functions. The types is a list of possible instances or functions to call (that return a `bool`) to determine the correct function to call to encode the data.

Type:
  `list`

Value:

      []

### strict

Whether the encoder should operate in 'strict' mode. Nothing is really affected by this for the time being - its just here for flexibility.

Type:
  `bool`, default is False.