Minor formatting tweaks and additional comments.
This commit is contained in:
parent
d133913c3d
commit
3f3747a2fe
@ -82,13 +82,14 @@ class BaseField(object):
|
|||||||
self.sparse = sparse
|
self.sparse = sparse
|
||||||
self._owner_document = None
|
self._owner_document = None
|
||||||
|
|
||||||
|
# Detect and report conflicts between metadata and base properties.
|
||||||
conflicts = set(dir(self)).intersect(kwargs)
|
conflicts = set(dir(self)).intersect(kwargs)
|
||||||
if conflicts:
|
if conflicts:
|
||||||
raise TypeError("%s already has attribute(s): %s" % (
|
raise TypeError("%s already has attribute(s): %s" % (
|
||||||
self.__class__.__name__,
|
self.__class__.__name__, ', '.join(conflicts) ))
|
||||||
', '.join(conflicts)
|
|
||||||
))
|
# Assign metadata to the instance
|
||||||
|
# This efficient method is available because no __slots__ are defined.
|
||||||
self.__dict__.update(kwargs)
|
self.__dict__.update(kwargs)
|
||||||
|
|
||||||
# Adjust the appropriate creation counter, and save our local copy.
|
# Adjust the appropriate creation counter, and save our local copy.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user