##// END OF EJS Templates
bug fix: sqlite3 is None when package is not installed
Benjie Chen -
Show More
@@ -106,7 +106,10 b' class HistoryAccessor(Configurable):'
106 db = Any()
106 db = Any()
107 def _db_changed(self, name, old, new):
107 def _db_changed(self, name, old, new):
108 """validate the db, since it can be an Instance of two different types"""
108 """validate the db, since it can be an Instance of two different types"""
109 if not isinstance(new, (sqlite3.Connection, DummyDB)):
109 connection_types = (DummyDB,)
110 if sqlite3 is not None:
111 connection_types = (DummyDB, sqlite3.Connection)
112 if not isinstance(new, connection_types):
110 msg = "%s.db must be sqlite3 Connection or DummyDB, not %r" % \
113 msg = "%s.db must be sqlite3 Connection or DummyDB, not %r" % \
111 (self.__class__.__name__, new)
114 (self.__class__.__name__, new)
112 raise TraitError(msg)
115 raise TraitError(msg)
General Comments 0
You need to be logged in to leave comments. Login now