summaryrefslogtreecommitdiff
path: root/Lib/bsddb/dbtables.py
diff options
context:
space:
mode:
authorCollin Winter <collinw@gmail.com>2007-08-22 21:45:20 +0000
committerCollin Winter <collinw@gmail.com>2007-08-22 21:45:20 +0000
commita65e94c1bf30259e0367d136054328c107ff41da (patch)
tree3e52a58cdad9ac85144590d72641e2f065d7382e /Lib/bsddb/dbtables.py
parent865ea892018f4ff823496b2d0636c47c7ef06231 (diff)
downloadcpython-git-a65e94c1bf30259e0367d136054328c107ff41da.tar.gz
Convert raise statements in bsddb.
Diffstat (limited to 'Lib/bsddb/dbtables.py')
-rw-r--r--Lib/bsddb/dbtables.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/Lib/bsddb/dbtables.py b/Lib/bsddb/dbtables.py
index c1628ab4d9..cc8ba77370 100644
--- a/Lib/bsddb/dbtables.py
+++ b/Lib/bsddb/dbtables.py
@@ -244,7 +244,7 @@ class bsdTableDB :
columnlist_key = _columns_key(table)
if self.db.has_key(columnlist_key):
- raise TableAlreadyExists, "table already exists"
+ raise TableAlreadyExists("table already exists")
txn = self.env.txn_begin()
# store the table's column info
@@ -261,7 +261,7 @@ class bsdTableDB :
txn.commit()
txn = None
except DBError as dberror:
- raise TableDBError, dberror.args[1]
+ raise TableDBError(dberror.args[1])
finally:
if txn:
txn.abort()
@@ -273,7 +273,7 @@ class bsdTableDB :
"""
assert isinstance(table, str)
if contains_metastrings(table):
- raise ValueError, "bad table name: contains reserved metastrings"
+ raise ValueError("bad table name: contains reserved metastrings")
columnlist_key = _columns_key(table)
if not self.db.has_key(columnlist_key):
@@ -340,7 +340,7 @@ class bsdTableDB :
self.__load_column_info(table)
except DBError as dberror:
- raise TableDBError, dberror.args[1]
+ raise TableDBError(dberror.args[1])
finally:
if txn:
txn.abort()
@@ -352,9 +352,9 @@ class bsdTableDB :
try:
tcolpickles = self.db.get(_columns_key(table))
except DBNotFoundError:
- raise TableDBError, "unknown table: %r" % (table,)
+ raise TableDBError("unknown table: %r" % (table,))
if not tcolpickles:
- raise TableDBError, "unknown table: %r" % (table,)
+ raise TableDBError("unknown table: %r" % (table,))
self.__tablecolumns[table] = pickle.loads(tcolpickles)
def __new_rowid(self, table, txn) :
@@ -388,14 +388,14 @@ class bsdTableDB :
txn = None
try:
if not self.db.has_key(_columns_key(table)):
- raise TableDBError, "unknown table"
+ raise TableDBError("unknown table")
# check the validity of each column name
if table not in self.__tablecolumns:
self.__load_column_info(table)
for column in rowdict.keys() :
if not self.__tablecolumns[table].count(column):
- raise TableDBError, "unknown column: %r" % (column,)
+ raise TableDBError("unknown column: %r" % (column,))
# get a unique row identifier for this row
txn = self.env.txn_begin()
@@ -419,7 +419,7 @@ class bsdTableDB :
txn.abort()
self.db.delete(_rowid_key(table, rowid))
txn = None
- raise TableDBError, dberror.args[1], info[2]
+ raise TableDBError(dberror.args[1]).with_traceback(info[2])
finally:
if txn:
txn.abort()
@@ -473,7 +473,7 @@ class bsdTableDB :
txn.abort()
except DBError as dberror:
- raise TableDBError, dberror.args[1]
+ raise TableDBError(dberror.args[1])
def Delete(self, table, conditions={}):
"""Delete(table, conditions) - Delete items matching the given
@@ -513,7 +513,7 @@ class bsdTableDB :
if txn:
txn.abort()
except DBError as dberror:
- raise TableDBError, dberror.args[1]
+ raise TableDBError(dberror.args[1])
def Select(self, table, columns, conditions={}):
@@ -533,7 +533,7 @@ class bsdTableDB :
columns = self.__tablecolumns[table]
matching_rowids = self.__Select(table, columns, conditions)
except DBError as dberror:
- raise TableDBError, dberror.args[1]
+ raise TableDBError(dberror.args[1])
# return the matches as a list of dictionaries
return matching_rowids.values()
@@ -554,7 +554,7 @@ class bsdTableDB :
columns = self.tablecolumns[table]
for column in (columns + list(conditions.keys())):
if not self.__tablecolumns[table].count(column):
- raise TableDBError, "unknown column: %r" % (column,)
+ raise TableDBError("unknown column: %r" % (column,))
# keyed on rows that match so far, containings dicts keyed on
# column names containing the data for that row and column.
@@ -708,7 +708,7 @@ class bsdTableDB :
del self.__tablecolumns[table]
except DBError as dberror:
- raise TableDBError, dberror.args[1]
+ raise TableDBError(dberror.args[1])
finally:
if txn:
txn.abort()