Package pyamf :: Package adapters

[hide private]
[frames] | no frames]

# Package adapters

source code

The adapter package provides additional functionality for other Python packages. This includes registering classes, setting up type maps etc.

Since: 0.1.0

Submodules | [hide private]

- pyamf.adapters._decimal: Adapter for the `decimal` module.
- pyamf.adapters._django_db_models_base: `django.db.models` adapter module.
- pyamf.adapters._django_db_models_fields: `django.db.models.fields` adapter module.
- pyamf.adapters._django_db_models_query: Django query adapter module.
- pyamf.adapters._google_appengine_ext_db: Google App Engine adapter module.
- pyamf.adapters._sets: Adapter for the stdlib `sets` module.
- pyamf.adapters._sqlalchemy: SQLAlchemy adapter module.
- pyamf.adapters.util: Useful helpers for adapters.

Classes | [hide private]

| PackageImporter Package importer used for lazy module loading.

Functions | [hide private]

register_adapters() | source code

register_adapter(mod, func) Registers a callable to be executed when a module is imported. | source code

Variables | [hide private]

| adapters_registered = `True`

Imports: os, glob, imports, _decimal, _sets, _sqlalchemy, util

Function Details | [hide private]

### register_adapter(mod, func)

source code

Registers a callable to be executed when a module is imported. If the module already exists then the callable will be executed immediately. You can register the same module multiple times, the callables will be executed in the order they were registered. The root module must exist (i.e. be importable) otherwise an `ImportError` will be thrown.

Parameters:
  - `mod` (`str`) - The fully qualified module string, as used in the imports statement. E.g. 'foo.bar.baz'. The string must map to a module otherwise the callable will not fire.
  - `func` (callable) - The function to call when `mod` is imported. This function must take one arg, the newly imported `module` object.
Raises:
  - `TypeError` - `func` must be callable