[csw-devel] SF.net SVN: gar:[12023] csw/mgar/gar/v2/lib/python/database.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Mon Dec 20 11:37:08 CET 2010


Revision: 12023
          http://gar.svn.sourceforge.net/gar/?rev=12023&view=rev
Author:   wahwah
Date:     2010-12-20 10:37:07 +0000 (Mon, 20 Dec 2010)

Log Message:
-----------
checkpkg: Better error message for DB schema

When there's a DB<-->application schema mismatch, offer a better error
message, suggest updating application sources.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/database.py

Modified: csw/mgar/gar/v2/lib/python/database.py
===================================================================
--- csw/mgar/gar/v2/lib/python/database.py	2010-12-20 03:20:47 UTC (rev 12022)
+++ csw/mgar/gar/v2/lib/python/database.py	2010-12-20 10:37:07 UTC (rev 12023)
@@ -80,7 +80,10 @@
       else:
         raise DatabaseError(
             "Database schema does not match the application. "
-            "Check the csw_config table and database.py.")
+            "Database contains: %s, "
+            "the application expects: %s. "
+            "Make sure your application sources are up to date."
+            % (ldm.GetDatabaseSchemaVersion(), DB_SCHEMA_VERSION))
 
   def _CheckAndMaybeFixFreshness(self, auto_fix):
     ldm = LocalDatabaseManager()
@@ -181,7 +184,12 @@
       table.clearTable()
 
   def IsDatabaseGoodSchema(self):
-    good_version = self.GetDatabaseSchemaVersion() >= DB_SCHEMA_VERSION
+    good_version = self.GetDatabaseSchemaVersion() == DB_SCHEMA_VERSION
+    if not good_version:
+      logging.fatal("Database schema version: %s, "
+                    "Application expects version: %s",
+                    self.GetDatabaseSchemaVersion(),
+                    DB_SCHEMA_VERSION)
     return good_version
 
   def GetDatabaseSchemaVersion(self):


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list