[server] Reprase messages of db-check to avoid using "system" and "sources"
authorDenis Laxalde <denis.laxalde@logilab.fr>
Wed, 08 Feb 2017 17:49:25 +0100
changeset 11957 48b8fbc88209
parent 11956 3199a40db419
child 11958 950ce7d9f642
[server] Reprase messages of db-check to avoid using "system" and "sources" And rather mention "entity type table" and "entities" table, which are clearer references.
cubicweb/server/checkintegrity.py
--- a/cubicweb/server/checkintegrity.py	Mon Feb 20 16:39:07 2017 +0100
+++ b/cubicweb/server/checkintegrity.py	Wed Feb 08 17:49:25 2017 +0100
@@ -174,7 +174,8 @@
 def check_text_index(schema, cnx, eids, fix=1):
     """check all entities registered in the text index"""
     print('Checking text index')
-    msg = '  Entity with eid %s exists in the text index but in no source (autofix will remove from text index)'
+    msg = ('  Entity with eid %s exists in the text index but not in any '
+           'entity type table (autofix will remove from text index)')
     cursor = cnx.system_sql('SELECT uid FROM appears;')
     for row in cursor.fetchall():
         eid = row[0]
@@ -190,7 +191,8 @@
     """check all entities registered in the repo system table"""
     print('Checking entities system table')
     # system table but no source
-    msg = '  Entity %s with eid %s exists in the system table but in no source (autofix will delete the entity)'
+    msg = ('  Entity %s with eid %s exists in "entities" table but not in any '
+           'entity type table (autofix will delete the entity)')
     cursor = cnx.system_sql('SELECT eid,type FROM entities;')
     for row in cursor.fetchall():
         eid, etype = row
@@ -243,7 +245,8 @@
                            '  WHERE cs.eid_from=e.eid AND cs.eid_to=s.cw_eid)')
         notify_fixed(True)
     print('Checking entities tables')
-    msg = '  Entity with eid %s exists in the %s table but not in the system table (autofix will delete the entity)'
+    msg = ('  Entity with eid %s exists in the %s table but not in "entities" '
+           'table (autofix will delete the entity)')
     for eschema in schema.entities():
         if eschema.final:
             continue
@@ -262,8 +265,9 @@
 
 
 def bad_related_msg(rtype, target, eid, fix):
-    msg = '  A relation %s with %s eid %s exists but no such entity in sources'
-    sys.stderr.write(msg % (rtype, target, eid))
+    msg = ('  A relation %(rtype)s with %(target)s eid %(eid)d exists but '
+           'entity #(eid)d does not exist')
+    sys.stderr.write(msg % {'rtype': rtype, 'target': target, 'eid': eid})
     notify_fixed(fix)