Commit
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -492,13 +492,19 @@ def __hash__(self): | |
def __str__(self): | ||
return '<TemplateHookRegistry: {0}>'.format(self._items) | ||
|
||
def __repr__(self): | ||
return '<TemplateHookRegistry: {0}>'.format(self.name) | ||
|
||
|
||
class CustomEncoder(json.JSONEncoder): | ||
def default(self, obj): | ||
try: | ||
return super(CustomEncoder, self).default(obj) | ||
except TypeError: | ||
s = repr(obj).split('0x', 1)[0] | ||
if isinstance(obj, set): | ||
This comment has been minimized.
Sorry, something went wrong. |
||
return self.encode(sorted(list(obj))) | ||
This comment has been minimized.
Sorry, something went wrong.
felixfontein
Contributor
|
||
else: | ||
s = repr(obj).split('0x', 1)[0] | ||
return s | ||
|
||
|
||
|
Why not include
frozenset
just in case as well? (Sorry, only added that later to my post...)