Property timestamp must be a datetime, current is unicode
- Dominant language
- Python
- Stars
- 263
- Forks
- 90
- PR merge metrics
- No merged PRs in 30d
Description
I've created a Document class as so:
class Base(Document):
... doc_schema = IntegerProperty(required=True)
... name = StringProperty(required=True)
... update = DateTimeProperty(required=True, auto_now=True)
... created = DateTimeProperty(required=True, auto_now_add=True)
I have some json returned by a db.get(doc_id)
{u'created': u'2012-01-07T18:17:39Z',
u'doc_schema': 0,
u'doc_type': u'test',
u'name': u'abc',
u'update': u'2012-01-07T18:17:39Z'}
I've also tried db.open_doc()
> > > account = Base(some_json_doc)
Traceback (most recent call last):
File "", line 1, in
File "/home/user/env/local/lib/python2.7/site-packages/couchdbkit/schema/base.py", line 405, in **init**
DocumentSchema.**init**(self, _d, **kwargs)
File "/home/user/env/local/lib/python2.7/site-packages/couchdbkit/schema/base.py", line 113, in __init__
prop.**property_init**(self, value)
File "/home/user/env/local/lib/python2.7/site-packages/couchdbkit/schema/properties.py", line 95, in **property_init**
value = self.to_json(self.validate(value, required=False))
File "/home/user/env/local/lib/python2.7/site-packages/couchdbkit/schema/properties.py", line 304, in validate
(self.name, self.data_type.**name**, type(value).**name**))
couchdbkit.exceptions.BadValueError: Property update must be a datetime, current is unicode
having a little look at what was going on, it appears the validate method is being called before the to_python so yes it is a unicode string and not a datetime object
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.