test tiramisu-json version

This commit is contained in:
Emmanuel Garette 2019-04-03 19:48:45 +02:00
parent a0b08ea1c8
commit dae6779e72
1 changed files with 4 additions and 0 deletions

View File

@ -9,6 +9,8 @@ from .setting import undefined
from .i18n import _ from .i18n import _
TIRAMISU_JSON_VERSION = '1.0'
TYPE = {'boolean': bool, TYPE = {'boolean': bool,
'integer': int, 'integer': int,
@ -488,6 +490,8 @@ class Config:
# config # config
def __init__(self, def __init__(self,
json): json):
if json.get('version') != TIRAMISU_JSON_VERSION:
raise Exception('incompatible tiramisu-json format version (got {}, expected {})'.format(json.get('version', '0.0'), TIRAMISU_JSON_VERSION))
self.model = json['model'] self.model = json['model']
self.form = json['form'] self.form = json['form']
self.form = {} self.form = {}