From 63185272253db8d7f5f940e212e2f11cc397d984 Mon Sep 17 00:00:00 2001 From: Daniel Roberts Date: Tue, 9 Sep 2014 18:17:32 -0400 Subject: [PATCH 1/5] change tests to reflect minor change in error message --- tests/test_schema.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_schema.py b/tests/test_schema.py index 972e0ec..281fb40 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -44,7 +44,7 @@ class Test(Document): try: doc.bar="bla" except AttributeError, e: - self.assert_(str(e) == "bar is not defined in schema (not a valid property)") + self.assertEqual(str(e), "'bar' is not defined in schema (not a valid property)") doc.save() self.assert_(not hasattr(doc, "bar")) assert doc._doc['foo'] == "test" @@ -59,7 +59,7 @@ class Test(StaticDocument): try: doc.bar="bla" except AttributeError, e: - self.assert_(str(e) == "bar is not defined in schema (not a valid property)") + self.assertEqual(str(e), "'bar' is not defined in schema (not a valid property)") doc.save() self.assert_(not hasattr(doc, "bar")) self.assert_(doc._doc['foo'] == "test") From 12163558d1bf19adc914a26f533134ddb4f3945e Mon Sep 17 00:00:00 2001 From: Daniel Roberts Date: Mon, 8 Sep 2014 14:55:21 -0400 Subject: [PATCH 2/5] make changes to accomodate jsonobject type config changes --- couchdbkit/__init__.py | 2 +- couchdbkit/ext/django/schema.py | 6 +++--- couchdbkit/schema/__init__.py | 4 ---- couchdbkit/schema/base.py | 6 +++--- couchdbkit/schema/properties.py | 6 ------ 5 files changed, 7 insertions(+), 17 deletions(-) diff --git a/couchdbkit/__init__.py b/couchdbkit/__init__.py index 600ebff..f309e1a 100644 --- a/couchdbkit/__init__.py +++ b/couchdbkit/__init__.py @@ -22,7 +22,7 @@ Property, IntegerProperty, DecimalProperty, BooleanProperty, FloatProperty, StringProperty, DateTimeProperty, DateProperty, TimeProperty, dict_to_json, dict_to_json, dict_to_json, - value_to_python, dict_to_python, + dict_to_python, DocumentSchema, DocumentBase, Document, StaticDocument, contain, QueryMixin, AttachmentMixin, SchemaProperty, SchemaListProperty, SchemaDictProperty, diff --git a/couchdbkit/ext/django/schema.py b/couchdbkit/ext/django/schema.py index ddd2334..237c0c7 100644 --- a/couchdbkit/ext/django/schema.py +++ b/couchdbkit/ext/django/schema.py @@ -34,7 +34,7 @@ 'DecimalProperty', 'BooleanProperty', 'FloatProperty', 'DateTimeProperty', 'DateProperty', 'TimeProperty', 'dict_to_json', 'list_to_json', 'value_to_json', - 'value_to_python', 'dict_to_python', 'list_to_python', + 'dict_to_python', 'list_to_python', 'convert_property', 'DocumentSchema', 'Document', 'SchemaProperty', 'SchemaListProperty', 'ListProperty', 'DictProperty', 'StringDictProperty', 'StringListProperty', @@ -42,7 +42,8 @@ DEFAULT_NAMES = ('verbose_name', 'db_table', 'ordering', - 'app_label') + 'app_label', 'string_conversions', 'properties', + 'update_properties') class Options(object): """ class based on django.db.models.options. We only keep @@ -180,7 +181,6 @@ def get_db(cls): dict_to_json = schema.dict_to_json list_to_json = schema.list_to_json value_to_json = schema.value_to_json -value_to_python = schema.value_to_python dict_to_python = schema.dict_to_python list_to_python = schema.list_to_python convert_property = schema.convert_property diff --git a/couchdbkit/schema/__init__.py b/couchdbkit/schema/__init__.py index 03b5399..b6fb5e5 100644 --- a/couchdbkit/schema/__init__.py +++ b/couchdbkit/schema/__init__.py @@ -156,7 +156,6 @@ class A(Dcoument): threadsafe. """ from .properties import ( - ALLOWED_PROPERTY_TYPES, Property, StringProperty, IntegerProperty, @@ -174,12 +173,9 @@ class A(Dcoument): dict_to_json, list_to_json, value_to_json, - MAP_TYPES_PROPERTIES, - value_to_python, dict_to_python, list_to_python, convert_property, - value_to_property, LazyDict, LazyList) diff --git a/couchdbkit/schema/base.py b/couchdbkit/schema/base.py index 8728448..50a23b8 100644 --- a/couchdbkit/schema/base.py +++ b/couchdbkit/schema/base.py @@ -13,14 +13,14 @@ from couchdbkit.utils import ProxyDict from ..exceptions import ResourceNotFound, ReservedWordError from . import properties as p -from .properties import value_to_python, \ -convert_property, MAP_TYPES_PROPERTIES, ALLOWED_PROPERTY_TYPES, \ +from .properties import \ +convert_property, \ LazyDict, LazyList from ..exceptions import DuplicatePropertyError, ResourceNotFound, \ ReservedWordError -__all__ = ['ReservedWordError', 'ALLOWED_PROPERTY_TYPES', 'DocumentSchema', +__all__ = ['ReservedWordError', 'DocumentSchema', 'SchemaProperties', 'DocumentBase', 'QueryMixin', 'AttachmentMixin', 'Document', 'StaticDocument', 'valid_id'] diff --git a/couchdbkit/schema/properties.py b/couchdbkit/schema/properties.py index 56d5361..8758f5a 100644 --- a/couchdbkit/schema/properties.py +++ b/couchdbkit/schema/properties.py @@ -5,12 +5,6 @@ import functools from jsonobject.properties import * from jsonobject.base import DefaultProperty -from jsonobject.convert import ( - ALLOWED_PROPERTY_TYPES, - MAP_TYPES_PROPERTIES, - value_to_python, - value_to_property -) try: from collections import MutableSet, Iterable From 30cf2b94c5627038e7307035565a1fbc63937652 Mon Sep 17 00:00:00 2001 From: Daniel Roberts Date: Mon, 8 Sep 2014 14:59:55 -0400 Subject: [PATCH 3/5] update jsonobject requirement --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 277e6cf..d6aea57 100755 --- a/setup.py +++ b/setup.py @@ -53,7 +53,7 @@ install_requires = [ 'restkit>=4.2.2', - 'jsonobject>=0.4.0', + 'jsonobject>=0.6.0', ], provides=['couchdbkit'], obsoletes=['couchdbkit'], From f2cfeea3aa1b4ac566f5274bb6a9f7a97aece8ac Mon Sep 17 00:00:00 2001 From: Daniel Roberts Date: Tue, 9 Sep 2014 18:04:48 -0400 Subject: [PATCH 4/5] change jsonobject version to 0.6.0b1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d6aea57..7650af7 100755 --- a/setup.py +++ b/setup.py @@ -53,7 +53,7 @@ install_requires = [ 'restkit>=4.2.2', - 'jsonobject>=0.6.0', + 'jsonobject>=0.6.0b1', ], provides=['couchdbkit'], obsoletes=['couchdbkit'], From f0c5332ca3f2bda4527df323efbd5cca31a89467 Mon Sep 17 00:00:00 2001 From: Daniel Roberts Date: Tue, 9 Sep 2014 18:40:56 -0400 Subject: [PATCH 5/5] drop support for python 2.6 --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index c85e3f1..97c1777 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,7 @@ language: python services: - couchdb -python: - - 2.6 - - 2.7 +python: 2.7 install: - pip install -r requirements_dev.txt --use-mirrors