mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:06:05 -04:00
Don't unfreeze when using FreezeEvent.get_dict, as we are using a JSONEncoder that understands FrozenDict
This commit is contained in:
parent
4ebbaf0d43
commit
ddb816cf60
6 changed files with 36 additions and 13 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue