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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Thu Jan 6 13:05:48 CET 2011


Revision: 12212
          http://gar.svn.sourceforge.net/gar/?rev=12212&view=rev
Author:   wahwah
Date:     2011-01-06 12:05:48 +0000 (Thu, 06 Jan 2011)

Log Message:
-----------
checkpkg: Better error messages on bad schema

Depending on which is newer, suggest either updating the application sources,
or the database.

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	2011-01-06 12:05:12 UTC (rev 12211)
+++ csw/mgar/gar/v2/lib/python/database.py	2011-01-06 12:05:48 UTC (rev 12212)
@@ -82,12 +82,17 @@
         ldm.InitialDataImport()
         ldm.SetDatabaseSchemaVersion()
       else:
-        raise DatabaseError(
+        msg = (
             "Database schema does not match the application. "
             "Database contains: %s, "
             "the application expects: %s. "
-            "Make sure your application sources are up to date."
             % (ldm.GetDatabaseSchemaVersion(), DB_SCHEMA_VERSION))
+        if DB_SCHEMA_VERSION < ldm.GetDatabaseSchemaVersion():
+          msg += "Make sure your application sources are up to date."
+        elif DB_SCHEMA_VERSION > ldm.GetDatabaseSchemaVersion():
+          msg += ("Make sure your database is up to date.  "
+                  "Re-create it if necessary.")
+        raise DatabaseError(msg)
 
   def _CheckAndMaybeFixFreshness(self, auto_fix):
     ldm = LocalDatabaseManager()


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