Skip to content

Commit

Permalink
more basic cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyroberts authored and benoitc committed Feb 9, 2013
1 parent c8dbfbc commit 4a24c36
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions couchdbkit/schema/base.py
Expand Up @@ -99,7 +99,7 @@ def __init__(self, _d=None, **properties):

if _d is not None:
if not isinstance(_d, dict):
raise TypeError('d should be a dict')
raise TypeError('_d should be a dict')
properties.update(_d)

doc_type = getattr(self, '_doc_type', self.__class__.__name__)
Expand Down Expand Up @@ -404,7 +404,7 @@ def __init__(self, _d=None, **kwargs):
docid = kwargs.pop('_id', _d.pop("_id", ""))
docrev = kwargs.pop('_rev', _d.pop("_rev", ""))

DocumentSchema.__init__(self, _d, **kwargs)
super(DocumentBase, self).__init__(_d, **kwargs)

if docid: self._doc['_id'] = valid_id(docid)
if docrev: self._doc['_rev'] = docrev
Expand Down
9 changes: 4 additions & 5 deletions couchdbkit/schema/properties_proxy.py
Expand Up @@ -4,9 +4,9 @@
# See the NOTICE for more information.

""" Meta properties """
import random


from ..exceptions import BadValueError
from ..exceptions import BadValueError

from .base import DocumentSchema
from .properties import Property
Expand Down Expand Up @@ -70,7 +70,7 @@ def __init__(self, schema, verbose_name=None, name=None,

self._use_instance = use_instance
self._schema = schema

def default_value(self):
if not self._use_instance:
if self.default:
Expand All @@ -96,7 +96,6 @@ def validate(self, value, required=True):
raise BadValueError(
'Property %s must be DocumentSchema instance, not a %s' % (self.name,
type(value).__name__))

return value

def to_python(self, value):
Expand Down Expand Up @@ -154,7 +153,7 @@ def validate(self, value, required=True):

def validate_list_schema(self, value, required=True):
for v in value:
v.validate(required=required)
v.validate(required=required)
return value

def default_value(self):
Expand Down

0 comments on commit 4a24c36

Please sign in to comment.