Metadata-Version: 2.0
Name: bpmappers
Version: 0.7
Summary: A mapping tool from model to dictionary.
Home-page: http://bpmappers.readthedocs.org/
Author: BeProud Inc.
Author-email: shinya.okano@beproud.jp
License: BSD License
Keywords: model,mapper,django
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Plugins
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.5
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: six
Provides-Extra: test
Requires-Dist: nose; extra == 'test'
Requires-Dist: coverage; extra == 'test'
Requires-Dist: Django; extra == 'test'
Requires-Dist: unittest2; extra == 'test'
Provides-Extra: django
Requires-Dist: Django; extra == 'django'

=========
bpmappers
=========

A mapping tool from model to dictionary.

::

   >>> from bpmappers import Mapper, RawField
   >>> class SpamMapper(Mapper):
   ...     spam = RawField('foo')
   ...     egg = RawField('bar')
   ...
   >>>
   >>> SpamMapper(dict(foo=123, bar='abc')).as_dict()
   {'egg': 'abc', 'spam': 123}
   >>>
   >>> class FooModel(object):
   ...     def __init__(self, foo, bar):
   ...         self.foo = foo
   ...         self.bar = bar
   ...
   >>> SpamMapper(FooModel(foo=123, bar='abc')).as_dict()
   {'egg': 'abc', 'spam': 123}
   >>>
   >>> class HogeMapper(Mapper):
   ...     hoge = RawField('hoge.piyo.fuga')
   ...
   >>> HogeMapper({'hoge': {'piyo': {'fuga': 123}}}).as_dict()
   {'hoge': 123}


