server/schemahooks.py
branchstable
changeset 3543 ed152fe5aa8b
parent 3531 c095f5f54873
child 3546 f0aecddf367e
equal deleted inserted replaced
3542:4c92cd09882f 3543:ed152fe5aa8b
   347         # final relations are not infered, propagate
   347         # final relations are not infered, propagate
   348         try:
   348         try:
   349             eschema = self.schema.eschema(rdef.subject)
   349             eschema = self.schema.eschema(rdef.subject)
   350         except KeyError:
   350         except KeyError:
   351             return # entity type currently being added
   351             return # entity type currently being added
       
   352         # propagate attribute to children classes
   352         rschema = self.schema.rschema(rdef.name)
   353         rschema = self.schema.rschema(rdef.name)
   353         props.update({'constraints': rdef.constraints,
   354         props.update({'constraints': rdef.constraints,
   354                       'description': rdef.description,
   355                       'description': rdef.description,
   355                       'cardinality': rdef.cardinality,
   356                       'cardinality': rdef.cardinality,
   356                       'constraints': rdef.constraints,
   357                       'constraints': rdef.constraints,
   359             if rschema.has_rdef(specialization, rdef.object):
   360             if rschema.has_rdef(specialization, rdef.object):
   360                 continue
   361                 continue
   361             for rql, args in ss.frdef2rql(rschema, str(specialization),
   362             for rql, args in ss.frdef2rql(rschema, str(specialization),
   362                                           rdef.object, props):
   363                                           rdef.object, props):
   363                 session.execute(rql, args)
   364                 session.execute(rql, args)
       
   365         # set default value, using sql for performance and to avoid
       
   366         # modification_date update
       
   367         if default:
       
   368             session.system_sql('UPDATE %s SET %s=%%(default)s' % (table, column),
       
   369                                {'default': default})
   364 
   370 
   365 
   371 
   366 class SourceDbCWRelationAdd(SourceDbCWAttributeAdd):
   372 class SourceDbCWRelationAdd(SourceDbCWAttributeAdd):
   367     """an actual relation has been added:
   373     """an actual relation has been added:
   368     * if this is an inlined relation, add the necessary column
   374     * if this is an inlined relation, add the necessary column