hooks/syncschema.py
changeset 11004 14ba505fb652
parent 10921 977def81780a
child 11005 f8417bd135ed
equal deleted inserted replaced
11003:53820b08a723 11004:14ba505fb652
    24 """
    24 """
    25 
    25 
    26 __docformat__ = "restructuredtext en"
    26 __docformat__ = "restructuredtext en"
    27 from cubicweb import _
    27 from cubicweb import _
    28 
    28 
       
    29 import json
    29 from copy import copy
    30 from copy import copy
    30 from hashlib import md5
    31 from hashlib import md5
       
    32 
    31 from yams.schema import (BASE_TYPES, BadSchemaDefinition,
    33 from yams.schema import (BASE_TYPES, BadSchemaDefinition,
    32                          RelationSchema, RelationDefinitionSchema)
    34                          RelationSchema, RelationDefinitionSchema)
    33 from yams import buildobjs as ybo, convert_default_value
    35 from yams import buildobjs as ybo, convert_default_value
    34 
    36 
    35 from logilab.common.decorators import clear_cache
    37 from logilab.common.decorators import clear_cache
   455             default = default.unzpickle()
   457             default = default.unzpickle()
   456         props = {'default': default,
   458         props = {'default': default,
   457                  'indexed': entity.indexed,
   459                  'indexed': entity.indexed,
   458                  'fulltextindexed': entity.fulltextindexed,
   460                  'fulltextindexed': entity.fulltextindexed,
   459                  'internationalizable': entity.internationalizable}
   461                  'internationalizable': entity.internationalizable}
       
   462         if entity.extra_props:
       
   463             props.update(json.load(entity.extra_props))
   460         # entity.formula may not exist yet if we're migrating to 3.20
   464         # entity.formula may not exist yet if we're migrating to 3.20
   461         if hasattr(entity, 'formula'):
   465         if hasattr(entity, 'formula'):
   462             props['formula'] = entity.formula
   466             props['formula'] = entity.formula
   463         # update the in-memory schema first
   467         # update the in-memory schema first
   464         rdefdef = self.init_rdef(**props)
   468         rdefdef = self.init_rdef(**props)