Add repr to namespacedict

This resolved #35813

The problem here was that we would pack __grains__ into modules
using a NamespacedDictWrapper which would normally work fine because
the typical use case was to either retrieve a particular item or to
iterate over the items. However, in cases where we returned the __grains__
dictionary entirely, it would be represented as an empty dictionary.
This commit is contained in:
Mike Place 2016-09-22 12:24:49 +09:00
parent 602bd2d1ef
commit 333842c319
No known key found for this signature in database
GPG key ID: 9136F4F13705CFD3

View file

@ -177,6 +177,9 @@ class NamespacedDictWrapper(collections.MutableMapping, dict):
r = r[k]
return r
def __repr__(self):
return repr(self._dict())
def __setitem__(self, key, val):
self._dict()[key] = val