1
0
Fork 0
mirror of https://github.com/yweber/lodel2.git synced 2025-11-30 08:36:53 +01:00

Implements order in fieldtype construct

This commit is contained in:
Yann 2016-01-14 16:36:46 +01:00
commit 1daf9677c6
5 changed files with 83 additions and 30 deletions

View file

@ -9,6 +9,8 @@ import warnings
import importlib
import re
from EditorialModel.fieldtypes.generic import DatasConstructor
REL_SUP = 0
REL_SUB = 1
@ -460,11 +462,14 @@ class _LeCrud(object):
# @todo Decide wether or not the datas are modifed inplace or returned in a new dict (second solution for the moment)
@classmethod
def _construct_datas(cls, datas):
res_datas = copy.copy(datas)
for fname, ftype in cls.fieldtypes().items():
if not ftype.is_internal() or ftype.internal != 'autosql':
res_datas[fname] = ftype.construct_data(cls, fname, res_datas)
return res_datas
constructor = DatasConstructor(cls, datas, cls.fieldtypes())
ret = {
fname:constructor[fname]
for fname, ftype in cls.fieldtypes().items()
if not ftype.is_internal() or ftype.internal != 'autosql'
}
return ret
## @brief Check datas consistency
# 
# @warning assert that datas is complete