##// END OF EJS Templates
Rename decorator needs_sqlite to only_when_enabled.
Terry Davis -
Show More
@@ -43,7 +43,7 b' class DummyDB(object):'
43 43
44 44
45 45 @decorator
46 def needs_sqlite(f, self, *a, **kw):
46 def only_when_enabled(f, self, *a, **kw):
47 47 """Decorator: return an empty list in the absence of sqlite."""
48 48 if not self.enabled:
49 49 return []
@@ -277,7 +277,7 b' class HistoryAccessor(HistoryAccessorBase):'
277 277 return ((ses, lin, (inp, out)) for ses, lin, inp, out in cur)
278 278 return cur
279 279
280 @needs_sqlite
280 @only_when_enabled
281 281 @catch_corrupt_db
282 282 def get_session_info(self, session):
283 283 """Get info about a session.
@@ -533,7 +533,7 b' class HistoryManager(HistoryAccessor):'
533 533 profile_dir = self.shell.profile_dir.location
534 534 return os.path.join(profile_dir, 'history.sqlite')
535 535
536 @needs_sqlite
536 @only_when_enabled
537 537 def new_session(self, conn=None):
538 538 """Get a new session number."""
539 539 if conn is None:
@@ -744,7 +744,7 b' class HistoryManager(HistoryAccessor):'
744 744 conn.execute("INSERT INTO output_history VALUES (?, ?, ?)",
745 745 (self.session_number,)+line)
746 746
747 @needs_sqlite
747 @only_when_enabled
748 748 def writeout_cache(self, conn=None):
749 749 """Write any entries in the cache to the database."""
750 750 if conn is None:
@@ -793,7 +793,7 b' class HistorySavingThread(threading.Thread):'
793 793 self.enabled = history_manager.enabled
794 794 atexit.register(self.stop)
795 795
796 @needs_sqlite
796 @only_when_enabled
797 797 def run(self):
798 798 # We need a separate db connection per thread:
799 799 try:
General Comments 0
You need to be logged in to leave comments. Login now