Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyroberts committed Aug 28, 2013
1 parent 0e791a2 commit 3c7b647
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion couchdbkit/schema/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,35 @@
# See the NOTICE for more information.
import functools
from jsonobject.properties import *
from jsonobject.base import DefaultProperty
from jsonobject.convert import ALLOWED_PROPERTY_TYPES

Property = JsonProperty
SchemaProperty = ObjectProperty
SchemaListProperty = ListProperty
StringListProperty = functools.partial(ListProperty, unicode)
SchemaDictProperty = DictProperty


class Property(DefaultProperty):
def wrap(self, obj):
try:
return self.to_python(obj)
except NotImplementedError:
return super(Property, self).wrap(obj)

def unwrap(self, obj):
try:
return obj, self.to_json(obj)
except NotImplementedError:
return super(Property, self).unwrap(obj)

def to_python(self, value):
raise NotImplementedError()

def to_json(self, value):
raise NotImplementedError()


dict_to_json = None
list_to_json = None
value_to_json = None
Expand Down

0 comments on commit 3c7b647

Please sign in to comment.