Skip to content

Commit

Permalink
unify required, null, and drop
Browse files Browse the repository at this point in the history
When I was trying to introspect schemas I printed out "missing:
<object object at 0x7fa8787da240>", "missing: <colander.null>" and
"missing: <colander._drop object at 0x7fa8737e4978>".  The first is
supposed to be a colander.required but unfortunately it's just a
generic object placeholder.  This PR is to unify colander.required,
colander.drop and colander.null.
  • Loading branch information
tisdall committed Apr 29, 2015
1 parent c49b70d commit 40a29fd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions colander/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@

_ = translationstring.TranslationStringFactory('colander')

required = object()
class _required(object):
""" Represents a required value in colander-related operations. """
def __repr__(self):
return '<colander.required>'

required = _required()
_marker = required # bw compat

class _null(object):
Expand All @@ -46,7 +51,8 @@ class _drop(object):
Represents a value that should be dropped if it is missing during
deserialization.
"""
pass
def __repr__(self):
return '<colander.drop>'

drop = _drop()

Expand Down

0 comments on commit 40a29fd

Please sign in to comment.