Generate more condensed Javascript to save bits in encryption
This commit is contained in:
parent
fd9e18a311
commit
9fc9d08fb4
@ -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()
|
||||
|
@ -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__()
|
||||
|
@ -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(',') + '}';
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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.<locals>.Person', 'value': expect1}
|
||||
expect1a = {'type': 'eos.core.tests.Person', 'value': expect1}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user