web/formfields.py
branchstable
changeset 9179 570208f74a84
parent 8695 358d8bed9626
child 9205 ea32e964fbf8
child 9213 312062f53981
equal deleted inserted replaced
9178:b5762ac9a82e 9179:570208f74a84
     1 # copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     1 # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     3 #
     3 #
     4 # This file is part of CubicWeb.
     4 # This file is part of CubicWeb.
     5 #
     5 #
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
  1146         if values is None:
  1146         if values is None:
  1147             values = ()
  1147             values = ()
  1148         elif not isinstance(values, list):
  1148         elif not isinstance(values, list):
  1149             values = (values,)
  1149             values = (values,)
  1150         eids = set()
  1150         eids = set()
       
  1151         rschema = form._cw.vreg.schema.rschema(self.name)
  1151         for eid in values:
  1152         for eid in values:
  1152             if not eid or eid == INTERNAL_FIELD_VALUE:
  1153             if not eid or eid == INTERNAL_FIELD_VALUE:
  1153                 continue
  1154                 continue
  1154             typed_eid = form.actual_eid(eid)
  1155             typed_eid = form.actual_eid(eid)
       
  1156             # if entity doesn't exist yet
  1155             if typed_eid is None:
  1157             if typed_eid is None:
  1156                 form._cw.data['pendingfields'].add( (form, self) )
  1158                 # inlined relations of to-be-created **subject entities** have
       
  1159                 # to be handled separatly
       
  1160                 if self.role == 'object' and rschema.inlined:
       
  1161                     form._cw.data['pending_inlined'][eid].add( (form, self) )
       
  1162                 else:
       
  1163                     form._cw.data['pending_others'].add( (form, self) )
  1157                 return None
  1164                 return None
  1158             eids.add(typed_eid)
  1165             eids.add(typed_eid)
  1159         return eids
  1166         return eids
  1160 
  1167 
  1161 
  1168