Assigning one ListField instance to another converts the data from a json
compatible list to an AnonymousStruct Schema instance. Repro:
class Post(Model):
title = TextField()
content = TextField()
pubdate = DateTimeField(default=datetime.now)
comments = ListField(DictField(Schema.build(
author = TextField(),
content = TextField(),
time = DateTimeField()
)))
post = Post(title='Foo bar')
post.comments.append(author='myself', content='Bla bla',
time=datetime.now())
print post.comments
post.comments = post.comments
print post.comments
You should see that the second print of post.comments is wrong. This
happens because ListField._to_json does not correctly convert a Proxy to
json data.
One possible solution is attached. Very small patch, but it sure took me a
while to figure out given the nested nature of DictField and ListField.
Original issue reported on code.google.com by schi...@gmail.com on 12 Jun 2008 at 1:11
Original issue reported on code.google.com by
schi...@gmail.com
on 12 Jun 2008 at 1:11Attachments: