Author: echuck
Date: Tue Jan 24 15:14:24 2006
New Revision: 4589
Modified:
Webware/trunk/MiddleKit/Run/SQLObjectStore.py
Log:
Give a useful error message when the class ids in the database don't match the class names in the model.
Modified: Webware/trunk/MiddleKit/Run/SQLObjectStore.py
==============================================================================
--- Webware/trunk/MiddleKit/Run/SQLObjectStore.py (original)
+++ Webware/trunk/MiddleKit/Run/SQLObjectStore.py Tue Jan 24 15:14:24 2006
@@ -206,7 +206,12 @@
klassesById = {}
for (id, name) in cur.fetchall():
assert id, "Id must be a non-zero int. id=%r, name=%r" % (id, name)
- klass = self._model.klass(name)
+ try:
+ klass = self._model.klass(name)
+ except KeyError:
+ filename = self._model.filename()
+ msg = '%s The database has a class id for %r in the _MKClassIds table, but no such class exists in the model %s. The model and the db are not in sync.' % (name, name, filename)
+ raise KeyError, msg
klassesById[id] = klass
klass.setId(id)
finally:
|