Fix StrictDict repr
This commit is contained in:
parent
be3643c962
commit
7b885ee0d3
@ -240,6 +240,8 @@ class StrictDict(object):
|
|||||||
if allowed_keys not in cls._classes:
|
if allowed_keys not in cls._classes:
|
||||||
class SpecificStrictDict(cls):
|
class SpecificStrictDict(cls):
|
||||||
__slots__ = allowed_keys_tuple
|
__slots__ = allowed_keys_tuple
|
||||||
|
def __repr__(self):
|
||||||
|
return "{%s}" % ', '.join('"{!s}": {!r}'.format(k,v) for (k,v) in self.iteritems())
|
||||||
cls._classes[allowed_keys] = SpecificStrictDict
|
cls._classes[allowed_keys] = SpecificStrictDict
|
||||||
return cls._classes[allowed_keys]
|
return cls._classes[allowed_keys]
|
||||||
|
|
||||||
|
@ -56,9 +56,9 @@ class BaseDocument(object):
|
|||||||
signals.pre_init.send(self.__class__, document=self, values=values)
|
signals.pre_init.send(self.__class__, document=self, values=values)
|
||||||
|
|
||||||
if self.STRICT and not self._dynamic:
|
if self.STRICT and not self._dynamic:
|
||||||
self._data = StrictDict.create(allowed_keys=self._fields.keys())()
|
self._data = StrictDict.create(allowed_keys=self._fields_ordered)()
|
||||||
else:
|
else:
|
||||||
self._data = SemiStrictDict.create(allowed_keys=self._fields.keys())()
|
self._data = SemiStrictDict.create(allowed_keys=self._fields_ordered)()
|
||||||
|
|
||||||
self._dynamic_fields = SON()
|
self._dynamic_fields = SON()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user