Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #104 from postatum/102163646_nested_mappings
Browse files Browse the repository at this point in the history
Rename DataProxy depth param to _depth
  • Loading branch information
jstoiko committed Sep 11, 2015
2 parents 429cbed + ed249be commit 64f9553
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions nefertari/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ def __init__(self, data={}):
def to_dict(self, **kwargs):
_dict = dictset()
_keys = kwargs.pop('_keys', [])
__depth = kwargs.pop('__depth', 1)
_depth = kwargs.pop('_depth', 1)

data = dictset(self._data).subset(_keys) if _keys else self._data

for attr, val in data.items():
_dict[attr] = val
if __depth:
if _depth:
kw = kwargs.copy()
kw['__depth'] = __depth - 1
kw['_depth'] = _depth - 1

if hasattr(val, 'to_dict'):
_dict[attr] = val.to_dict(**kw)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_data_proxy_model_keys(self):
def test_data_proxy_model_no_depth(self):
obj = DummyModel({'foo1': 'bar1'})
proxy = dutils.DataProxy({'foo': obj})
data = proxy.to_dict(__depth=0)
data = proxy.to_dict(_depth=0)
assert data == {'_type': 'DataProxy', 'foo': obj}

def test_data_proxy_model_sequence(self):
Expand Down

0 comments on commit 64f9553

Please sign in to comment.