diff --git a/eos/base/election.py b/eos/base/election.py index a10672d..4b44a2d 100644 --- a/eos/base/election.py +++ b/eos/base/election.py @@ -132,8 +132,6 @@ class PreferentialAnswer(Answer): choices = ListField(IntField()) class RawResult(Result): - _ver = StringField(default='0.2') - plaintexts = ListField(EmbeddedObjectListField()) answers = EmbeddedObjectListField() @@ -149,8 +147,6 @@ class RawResult(Result): return combined class Election(TopLevelObject): - _ver = StringField(default='0.2') - _id = UUIDField() workflow = EmbeddedObjectField(Workflow) # Once saved, we don't care what kind of workflow it is name = StringField() diff --git a/eos/core/objects/__init__.py b/eos/core/objects/__init__.py index 8c7ed9a..aa915dc 100644 --- a/eos/core/objects/__init__.py +++ b/eos/core/objects/__init__.py @@ -222,7 +222,7 @@ class EosObject(metaclass=EosObjectType): @staticmethod def to_json(value): if is_python: - return json.dumps(value, sort_keys=True) + return json.dumps(value, sort_keys=True, separators=(',', ':')) else: return lib.stringify(value) @@ -337,7 +337,7 @@ class DocumentObjectType(EosObjectType): return cls class DocumentObject(EosObject, metaclass=DocumentObjectType): - _ver = StringField(default='0.1') + _ver = StringField(default='0.3') def __init__(self, *args, **kwargs): super().__init__() diff --git a/eos/core/objects/json.js b/eos/core/objects/json.js index 82b9202..1c9e8c3 100644 --- a/eos/core/objects/json.js +++ b/eos/core/objects/json.js @@ -53,7 +53,7 @@ function stringify(parent, key, node, level) { var item = stringify(node, i, node[i], level+1) || JSON.stringify(null); out.push(item); } - return '[' + out.join(', ') + ']'; + return '[' + out.join(',') + ']'; } else { if (seen.indexOf(node) !== -1) { throw new TypeError('Converting circular structure to JSON'); @@ -71,11 +71,11 @@ function stringify(parent, key, node, level) { continue; } - var keyValue = JSON.stringify(key) + ': ' + value; + var keyValue = JSON.stringify(key) + ':' + value; out.push(keyValue); } seen.splice(seen.indexOf(node), 1); - return '{' + out.join(', ') + '}'; + return '{' + out.join(',') + '}'; } }; diff --git a/eos/core/tests.py b/eos/core/tests.py index a8ed751..81c6957 100644 --- a/eos/core/tests.py +++ b/eos/core/tests.py @@ -96,7 +96,7 @@ class ObjectTestCase(EosTestCase): def test_serialise(self): person1 = self.Person(name='John', address='Address 1') - expect1 = {'_ver': '0.1', 'name': 'John', 'address': 'Address 1'} + expect1 = {'_ver': person1._ver, 'name': 'John', 'address': 'Address 1'} #expect1a = {'type': 'eos.core.tests.ObjectTestCase.setUpClass..Person', 'value': expect1} expect1a = {'type': 'eos.core.tests.Person', 'value': expect1}