Mercurial > hg > Feedworm
view backend/couchdb/ListDateTimeField.py @ 187:2f2016a10f7d
handle a missing updated_parsed attribute in a feed entry gracefully
author | dirk |
---|---|
date | Tue, 13 Sep 2011 17:52:36 +0200 |
parents | f0afcd1c5656 |
children | bb3c851b18b1 |
line wrap: on
line source
from couchdb.mapping import Field from datetime import datetime class ListDateTimeField(Field): def _to_python(self, value): if isinstance(value, list): return datetime(*value) return value def _to_json(self, value): if isinstance(value, datetime): return [ value.year, value.month, value.day, value.hour, value.minute, value.second ] return value