diff --git a/IPython/core/history.py b/IPython/core/history.py index 7f79b18..82d4d6e 100644 --- a/IPython/core/history.py +++ b/IPython/core/history.py @@ -43,7 +43,7 @@ class DummyDB(object): @decorator -def needs_sqlite(f, self, *a, **kw): +def only_when_enabled(f, self, *a, **kw): """Decorator: return an empty list in the absence of sqlite.""" if not self.enabled: return [] @@ -277,7 +277,7 @@ class HistoryAccessor(HistoryAccessorBase): return ((ses, lin, (inp, out)) for ses, lin, inp, out in cur) return cur - @needs_sqlite + @only_when_enabled @catch_corrupt_db def get_session_info(self, session): """Get info about a session. @@ -533,7 +533,7 @@ class HistoryManager(HistoryAccessor): profile_dir = self.shell.profile_dir.location return os.path.join(profile_dir, 'history.sqlite') - @needs_sqlite + @only_when_enabled def new_session(self, conn=None): """Get a new session number.""" if conn is None: @@ -744,7 +744,7 @@ class HistoryManager(HistoryAccessor): conn.execute("INSERT INTO output_history VALUES (?, ?, ?)", (self.session_number,)+line) - @needs_sqlite + @only_when_enabled def writeout_cache(self, conn=None): """Write any entries in the cache to the database.""" if conn is None: @@ -793,7 +793,7 @@ class HistorySavingThread(threading.Thread): self.enabled = history_manager.enabled atexit.register(self.stop) - @needs_sqlite + @only_when_enabled def run(self): # We need a separate db connection per thread: try: