web/formfields.py
changeset 9205 ea32e964fbf8
parent 9147 01124cfd4b1f
parent 9179 570208f74a84
child 9217 b4ac21bf6019
equal deleted inserted replaced
9149:31ed9dd946d1 9205:ea32e964fbf8
     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
  1151         if values is None:
  1151         if values is None:
  1152             values = ()
  1152             values = ()
  1153         elif not isinstance(values, list):
  1153         elif not isinstance(values, list):
  1154             values = (values,)
  1154             values = (values,)
  1155         eids = set()
  1155         eids = set()
       
  1156         rschema = form._cw.vreg.schema.rschema(self.name)
  1156         for eid in values:
  1157         for eid in values:
  1157             if not eid or eid == INTERNAL_FIELD_VALUE:
  1158             if not eid or eid == INTERNAL_FIELD_VALUE:
  1158                 continue
  1159                 continue
  1159             typed_eid = form.actual_eid(eid)
  1160             typed_eid = form.actual_eid(eid)
       
  1161             # if entity doesn't exist yet
  1160             if typed_eid is None:
  1162             if typed_eid is None:
  1161                 form._cw.data['pendingfields'].add( (form, self) )
  1163                 # inlined relations of to-be-created **subject entities** have
       
  1164                 # to be handled separatly
       
  1165                 if self.role == 'object' and rschema.inlined:
       
  1166                     form._cw.data['pending_inlined'][eid].add( (form, self) )
       
  1167                 else:
       
  1168                     form._cw.data['pending_others'].add( (form, self) )
  1162                 return None
  1169                 return None
  1163             eids.add(typed_eid)
  1170             eids.add(typed_eid)
  1164         return eids
  1171         return eids
  1165 
  1172 
  1166 
  1173