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