Skip to content

Commit

Permalink
Allow nesting of dict subtypes
Browse files Browse the repository at this point in the history
  • Loading branch information
sloria committed Mar 4, 2015
1 parent 708d440 commit 4552f23
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
---------

0.11.1 (unreleased)
*******************

Changes:

* Allow nesting of dict subtypes.

0.11.0 (2015-03-01)
*******************

Expand Down
4 changes: 4 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ def test_nested_argdict_has_type_dict(self):

assert 'Expected type "object" for myarg, got "string"' in str(excinfo)

def test_nested_argdict_can_be_a_dict_subclass(self):
arg = Arg(DjMultiDict({'foo': Arg()}))
assert arg.type == DjMultiDict

def test_has_nesting(self):
arg = Arg({'foo': Arg()})
assert arg._has_nesting is True
Expand Down
2 changes: 1 addition & 1 deletion webargs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def __init__(self, type_=None, default=None, required=False,
validate=None, use=None, multiple=False, error=None,
allow_missing=False, location=None, dest=None, source=None, **metadata):
if isinstance(type_, dict):
self.type = dict
self.type = type(type_) # type will always be a dict
self._nested_args = type_
self._has_nesting = True
else:
Expand Down

0 comments on commit 4552f23

Please sign in to comment.