fnp
/
django-ssify.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
v. 0.2.4:
[django-ssify.git]
/
ssify
/
serializers.py
diff --git
a/ssify/serializers.py
b/ssify/serializers.py
index
a96356c
..
8a44c7b
100644
(file)
--- a/
ssify/serializers.py
+++ b/
ssify/serializers.py
@@
-1,19
+1,25
@@
+# -*- coding: utf-8 -*-
+# This file is part of django-ssify, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See README.md for more information.
+#
+from __future__ import unicode_literals
import json
from .variables import SsiVariable, SsiExpect
def _json_default(o):
if isinstance(o, SsiVariable):
import json
from .variables import SsiVariable, SsiExpect
def _json_default(o):
if isinstance(o, SsiVariable):
- return {'__var__': o.
name
}
+ return {'__var__': o.
definition
}
if isinstance(o, SsiExpect):
return {'__expect__': o.name}
raise TypeError(o, 'not JSON serializable')
def _json_obj_hook(obj):
if isinstance(o, SsiExpect):
return {'__expect__': o.name}
raise TypeError(o, 'not JSON serializable')
def _json_obj_hook(obj):
- if obj.keys() == ['__var__']:
- return SsiVariable(name=obj['__var__'])
- if obj.keys() == ['__expect__']:
+ keys = list(obj.keys())
+ if keys == ['__var__']:
+ return SsiVariable(*obj['__var__'])
+ if keys == ['__expect__']:
return SsiExpect(obj['__expect__'])
return obj
return SsiExpect(obj['__expect__'])
return obj