Skip to content
This repository has been archived by the owner on Jul 14, 2020. It is now read-only.

SchemaDocument update method unexpected behavior when using i18n fields #234

Open
AlmogCohen opened this issue Mar 16, 2015 · 0 comments
Open

Comments

@AlmogCohen
Copy link

Assuming we do the following:

class Doc(SchemaDocument):
    structure = {'test': u''}
    i18n = ['test']

then registering the Doc to some collection we initiate a doc:
doc = con.test.Doc()

now I would assume that those two lines would create the same document:

doc.test = u'this is working with i18n!'
doc.validate() # this one is working, and i18n field is doing fine

doc.update({'test': u'this is NOT working!'}) # update just replace the value of 'text' avoiding the  custom __setattr__
doc.validate() # FAIL!

I think that the 'update' method should be also custom and could use the custom setattr
I've also written a test that demonstrate this case.
Do you agree that the behavior should be the same?

Is there another preferred way to use 'update' or should I create a Pull Request?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant