devtools/fill.py
branchstable
changeset 3749 a84e798b99f6
parent 3747 9165bd634f90
child 4053 7cc66b1d9183
child 4212 ab6573088b4a
--- a/devtools/fill.py	Tue Oct 20 14:24:19 2009 +0200
+++ b/devtools/fill.py	Tue Oct 20 14:34:42 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)