[d-c check-mapping] small enhancements to avoid spurious warnings
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 25 Oct 2010 15:36:52 +0200
changeset 6624 b30e5428048b
parent 6623 4cb6d319d16d
child 6625 54847e2c4a50
[d-c check-mapping] small enhancements to avoid spurious warnings
server/checkintegrity.py
--- a/server/checkintegrity.py	Mon Oct 25 15:32:00 2010 +0200
+++ b/server/checkintegrity.py	Mon Oct 25 15:36:52 2010 +0200
@@ -336,6 +336,11 @@
         cnx.commit()
 
 
+def info(msg, *args):
+    if args:
+        msg = msg % args
+    print 'INFO: %s' % msg
+
 def warning(msg, *args):
     if args:
         msg = msg % args
@@ -374,13 +379,13 @@
     # check relation in dont_cross_relations aren't in support_relations
     for rschema in mapping['dont_cross_relations']:
         if rschema in mapping['support_relations']:
-            warning('relation %s is in dont_cross_relations and in support_relations',
-                    rschema)
+            info('relation %s is in dont_cross_relations and in support_relations',
+                 rschema)
     # check relation in cross_relations are in support_relations
     for rschema in mapping['cross_relations']:
         if rschema not in mapping['support_relations']:
-            warning('relation %s is in cross_relations but not in support_relations',
-                    rschema)
+            info('relation %s is in cross_relations but not in support_relations',
+                 rschema)
     # check for relation in both cross_relations and dont_cross_relations
     for rschema in mapping['cross_relations'] & mapping['dont_cross_relations']:
         error('relation %s is in both cross_relations and dont_cross_relations',
@@ -410,7 +415,7 @@
                     if role == 'subject' and rschema.inlined:
                         error('inlined relation %s of %s should be supported',
                               rschema, eschema)
-                    elif not somethingprinted and rschema not in seen:
+                    elif not somethingprinted and rschema not in seen and rschema not in mapping['cross_relations']:
                         print 'you may want to specify something for %s' % rschema
                         seen.add(rschema)
             else: