Permalink
Browse files

Move error catching for corrupt database - error wasn't actually rais…

…ed in _run_sql()
  • Loading branch information...
1 parent f615404 commit 2c9d79fb513bf79326f424d749da810ce7472057 @takluyver committed Sep 19, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 IPython/core/history.py
@@ -221,7 +221,6 @@ def writeout_cache(self):
## -------------------------------
## Methods for retrieving history:
## -------------------------------
- @catch_corrupt_db
def _run_sql(self, sql, params, raw=True, output=False):
"""Prepares and runs an SQL query for the history database.
@@ -278,6 +277,7 @@ def get_session_info(self, session=0):
query = "SELECT * from sessions where session == ?"
return self.db.execute(query, (session,)).fetchone()
+ @catch_corrupt_db
def get_tail(self, n=10, raw=True, output=False, include_latest=False):
"""Get the last n lines from the history database.
@@ -305,6 +305,7 @@ def get_tail(self, n=10, raw=True, output=False, include_latest=False):
return reversed(list(cur)[1:])
return reversed(list(cur))
+ @catch_corrupt_db
def search(self, pattern="*", raw=True, search_raw=True,
output=False, n=None):
"""Search the database using unix glob-style matching (wildcards
@@ -339,7 +340,8 @@ def search(self, pattern="*", raw=True, search_raw=True,
if n is not None:
return reversed(list(cur))
return cur
-
+
+ @catch_corrupt_db
def get_range(self, session, start=1, stop=None, raw=True,output=False):
"""Retrieve input by session.

0 comments on commit 2c9d79f

Please sign in to comment.