Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buggy SchemaDictProperty #119

Open
sirex opened this issue Feb 16, 2012 · 2 comments
Open

Buggy SchemaDictProperty #119

sirex opened this issue Feb 16, 2012 · 2 comments

Comments

@sirex
Copy link

sirex commented Feb 16, 2012

Here is patch to tests, that demonstrates, how to reprodice this bug:

diff --git a/tests/test_schema.py b/tests/test_schema.py
index d141ebf..f7c8058 100644
--- a/tests/test_schema.py
+++ b/tests/test_schema.py
@@ -1353,6 +1353,10 @@ class PropertyTestCase(unittest.TestCase):
         self.assert_(b1.d['v1'].i == 123)
         self.assert_(b1.d[23].i == 42)

+        b1.d = {23: {'i': 321}}
+        b1.set_db(self.db)
+        b1.save()
+

     def testListProperty(self):
         from datetime import datetime

This bug only occurs, when trying to assign dictionary to bounded object. When
I try to do this on new object, everything works ok.

@benoitc
Copy link
Owner

benoitc commented Feb 16, 2012

can you add the trace you have ?

@sirex
Copy link
Author

sirex commented Feb 17, 2012

======================================================================
ERROR: testSchemaDictProperty (tests.test_schema.PropertyTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/sirex/devel/couchdbkit/tests/test_schema.py", line 1356, in testSchemaDictProperty
    b1.d = {23: {'i': 321}}
  File "/home/sirex/devel/couchdbkit/couchdbkit/schema/base.py", line 216, in __setattr__
    object.__setattr__(self, key, value)
  File "/home/sirex/devel/couchdbkit/couchdbkit/schema/properties.py", line 109, in __set__
    value = self.validate(value, required=False)
  File "/home/sirex/devel/couchdbkit/couchdbkit/schema/properties_proxy.py", line 318, in validate
    value = self.validate_dict_schema(value, required=required)
  File "/home/sirex/devel/couchdbkit/couchdbkit/schema/properties_proxy.py", line 323, in validate_dict_schema
    v.validate(required=required)
AttributeError: 'dict' object has no attribute 'validate'

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

No branches or pull requests

2 participants