##// END OF EJS Templates
Move error catching for corrupt database - error wasn't actually raised in _run_sql()
Thomas Kluyver -
Show More
@@ -221,7 +221,6 b' class HistoryAccessor(Configurable):'
221 ## -------------------------------
221 ## -------------------------------
222 ## Methods for retrieving history:
222 ## Methods for retrieving history:
223 ## -------------------------------
223 ## -------------------------------
224 @catch_corrupt_db
225 def _run_sql(self, sql, params, raw=True, output=False):
224 def _run_sql(self, sql, params, raw=True, output=False):
226 """Prepares and runs an SQL query for the history database.
225 """Prepares and runs an SQL query for the history database.
227
226
@@ -278,6 +277,7 b' class HistoryAccessor(Configurable):'
278 query = "SELECT * from sessions where session == ?"
277 query = "SELECT * from sessions where session == ?"
279 return self.db.execute(query, (session,)).fetchone()
278 return self.db.execute(query, (session,)).fetchone()
280
279
280 @catch_corrupt_db
281 def get_tail(self, n=10, raw=True, output=False, include_latest=False):
281 def get_tail(self, n=10, raw=True, output=False, include_latest=False):
282 """Get the last n lines from the history database.
282 """Get the last n lines from the history database.
283
283
@@ -305,6 +305,7 b' class HistoryAccessor(Configurable):'
305 return reversed(list(cur)[1:])
305 return reversed(list(cur)[1:])
306 return reversed(list(cur))
306 return reversed(list(cur))
307
307
308 @catch_corrupt_db
308 def search(self, pattern="*", raw=True, search_raw=True,
309 def search(self, pattern="*", raw=True, search_raw=True,
309 output=False, n=None):
310 output=False, n=None):
310 """Search the database using unix glob-style matching (wildcards
311 """Search the database using unix glob-style matching (wildcards
@@ -339,7 +340,8 b' class HistoryAccessor(Configurable):'
339 if n is not None:
340 if n is not None:
340 return reversed(list(cur))
341 return reversed(list(cur))
341 return cur
342 return cur
342
343
344 @catch_corrupt_db
343 def get_range(self, session, start=1, stop=None, raw=True,output=False):
345 def get_range(self, session, start=1, stop=None, raw=True,output=False):
344 """Retrieve input by session.
346 """Retrieve input by session.
345
347
General Comments 0
You need to be logged in to leave comments. Login now