Skip to content

Commit

Permalink
Merge pull request #3 from dimagi/jsonobject-type-config
Browse files Browse the repository at this point in the history
make changes to accomodate jsonobject type config changes
  • Loading branch information
millerdev committed Sep 10, 2014
2 parents efe6ea5 + f0c5332 commit 3d7c49b
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 23 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion couchdbkit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions couchdbkit/ext/django/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@
'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',
'SchemaDictProperty', 'SetProperty',]


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
Expand Down Expand Up @@ -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
4 changes: 0 additions & 4 deletions couchdbkit/schema/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ class A(Dcoument):
threadsafe.
"""
from .properties import (
ALLOWED_PROPERTY_TYPES,
Property,
StringProperty,
IntegerProperty,
Expand All @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions couchdbkit/schema/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand Down
6 changes: 0 additions & 6 deletions couchdbkit/schema/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

install_requires = [
'restkit>=4.2.2',
'jsonobject>=0.4.0',
'jsonobject>=0.6.0b1',
],
provides=['couchdbkit'],
obsoletes=['couchdbkit'],
Expand Down
4 changes: 2 additions & 2 deletions tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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")
Expand Down

0 comments on commit 3d7c49b

Please sign in to comment.