diff options
author | Erik Johnston <erik@matrix.org> | 2015-02-11 15:44:28 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-02-11 15:44:28 +0000 |
commit | ddb816cf60ca1b0c0f9bfab5df233a010ac309a3 (patch) | |
tree | c3db58914617f2375c603f6c5d1eb8ca5d2600b2 /synapse/util/frozenutils.py | |
parent | Blunty replace json with simplejson (diff) | |
download | synapse-ddb816cf60ca1b0c0f9bfab5df233a010ac309a3.tar.xz |
Don't unfreeze when using FreezeEvent.get_dict, as we are using a JSONEncoder that understands FrozenDict
Diffstat (limited to 'synapse/util/frozenutils.py')
-rw-r--r-- | synapse/util/frozenutils.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/util/frozenutils.py b/synapse/util/frozenutils.py index a13a2015e4..9e10d37aec 100644 --- a/synapse/util/frozenutils.py +++ b/synapse/util/frozenutils.py @@ -21,6 +21,9 @@ def freeze(o): if t is dict: return frozendict({k: freeze(v) for k, v in o.items()}) + if t is frozendict: + return o + if t is str or t is unicode: return o @@ -33,10 +36,11 @@ def freeze(o): def unfreeze(o): - if isinstance(o, frozendict) or isinstance(o, dict): + t = type(o) + if t is dict or t is frozendict: return dict({k: unfreeze(v) for k, v in o.items()}) - if isinstance(o, basestring): + if t is str or t is unicode: return o try: |