merge stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 20 Oct 2009 16:22:52 +0200
branchstable
changeset 3753 310621cfed9b
parent 3752 4c77a1653374 (current diff)
parent 3749 a84e798b99f6 (diff)
child 3754 a9c641f6193b
merge
--- a/devtools/fill.py	Tue Oct 20 16:22:33 2009 +0200
+++ b/devtools/fill.py	Tue Oct 20 16:22:52 2009 +0200
@@ -379,14 +379,15 @@
                 subjcard, objcard = rschema.rproperty(subj, obj, 'cardinality')
                 # process mandatory relations first
                 if subjcard in '1+' or objcard in '1+' or composite_relation(rschema):
-                    queries += self.make_relation_queries(sedict, oedict,
-                                                          rschema, subj, obj)
+                    for query, args in self.make_relation_queries(sedict, oedict,
+                                                          rschema, subj, obj):
+                        yield query, args
                 else:
                     delayed.append( (subj, obj) )
             for subj, obj in delayed:
-                queries += self.make_relation_queries(sedict, oedict, rschema,
-                                                      subj, obj)
-        return queries
+                for query, args in self.make_relation_queries(sedict, oedict, rschema,
+                                                              subj, obj):
+                    yield query, args
 
     def qargs(self, subjeids, objeids, subjcard, objcard, subjeid, objeid):
         if subjcard in '?1':
@@ -472,8 +473,9 @@
 
 def check_card_satisfied(card, remaining, subj, rschema, obj):
     if card in '1+' and remaining:
-        print "can't satisfy cardinality %s for relation %s %s %s" % (card, subj, rschema, obj)
-        
+        raise Exception("can't satisfy cardinality %s for relation %s %s %s" %
+                        (card, subj, rschema, obj))
+
 
 def choose_eid(values, avoid):
     values = tuple(values)
--- a/web/views/editforms.py	Tue Oct 20 16:22:33 2009 +0200
+++ b/web/views/editforms.py	Tue Oct 20 16:22:52 2009 +0200
@@ -222,7 +222,7 @@
 
     def _build_args(self, entity, rtype, role, formid, default, reload, lzone,
                     extradata=None):
-        divid = '%s-%s-%s' % (entity.eid, rtype, role)
+        divid = '%s-%s-%s' % (rtype, role, entity.eid)
         event_args = {'divid' : divid, 'eid' : entity.eid, 'rtype' : rtype,
                       'reload' : dumps(reload), 'default' : default, 'role' : role, 'vid' : u'',
                       'lzone' : lzone}