Fix StrictDict repr

This commit is contained in:
Ross Lawley
2014-06-30 10:29:28 +01:00
parent be3643c962
commit 7b885ee0d3
2 changed files with 4 additions and 2 deletions

View File

@@ -240,6 +240,8 @@ class StrictDict(object):
if allowed_keys not in cls._classes:
class SpecificStrictDict(cls):
__slots__ = allowed_keys_tuple
def __repr__(self):
return "{%s}" % ', '.join('"{!s}": {!r}'.format(k,v) for (k,v) in self.iteritems())
cls._classes[allowed_keys] = SpecificStrictDict
return cls._classes[allowed_keys]