From 3c8d448a57071cd24d0693ef12154a9311de0504 2012-08-20 16:33:41 From: Thomas Kluyver Date: 2012-08-20 16:33:41 Subject: [PATCH] Merge pull request #2300 from benjiec/master bug fix: was crashing when sqlite3 is not installed --- diff --git a/IPython/core/history.py b/IPython/core/history.py index 73f1b72..5a61893 100644 --- a/IPython/core/history.py +++ b/IPython/core/history.py @@ -106,7 +106,10 @@ class HistoryAccessor(Configurable): db = Any() def _db_changed(self, name, old, new): """validate the db, since it can be an Instance of two different types""" - if not isinstance(new, (sqlite3.Connection, DummyDB)): + connection_types = (DummyDB,) + if sqlite3 is not None: + connection_types = (DummyDB, sqlite3.Connection) + if not isinstance(new, connection_types): msg = "%s.db must be sqlite3 Connection or DummyDB, not %r" % \ (self.__class__.__name__, new) raise TraitError(msg)