API and directive converting object to ``dict``.
Project description
rebecca.todict
rebecca.todict is API and directive converting object to dict.
INSTALL
Install using pip or easy_install.:
$ pip install rebecca.todict $ easy_install rebecca.todict
USAGE
rebecca.todict privides includeme hook that will set up set_todict directive.:
config.include('rebecca.todict')
using with paste deploy:
pyramid.includes = rebecca.todict
register todict adapter
To register todict adapter, you can use set_todict directive.:
config.set_todict(Person, person_to_dict)
That register todict adapter converging Person object to dict.
You can register named adapter too:
config.set_todict(Person, person_to_dict_short, name="short")
using todict API
Registered adapters are used by todict API:
from rebecca.todict import todict d = todict(request, person)
d = todict(request, person, name="short")
Contributors
Atsushi Odagiri, Original Author
Changelog
0.1 (2013-02-16)
first commit
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rebecca.todict-0.1.tar.gz
(2.9 kB
view details)
File details
Details for the file rebecca.todict-0.1.tar.gz
.
File metadata
- Download URL: rebecca.todict-0.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8558ceb306728b3788f4812d23aab9723390be61ec5da68df4815ee5021f6b53 |
|
MD5 | fa2d84e31885506300999b13966968e9 |
|
BLAKE2b-256 | 7dcf9eddca31888b082c4bcdfab1948e0ba82d8b26caf732dff8c9f3483b356c |