# column names
newcolumnlist = copy.copy(oldcolumnlist)
for c in columns:
- if not oldcolumnhash.has_key(c):
+ if c not in oldcolumnhash:
newcolumnlist.append(c)
# store the table's new extended column list
raise TableDBError, "unknown table"
# check the validity of each column name
- if not self.__tablecolumns.has_key(table):
+ if table not in self.__tablecolumns:
self.__load_column_info(table)
for column in rowdict.keys() :
if not self.__tablecolumns[table].count(column):
argument and returning a boolean.
"""
try:
- if not self.__tablecolumns.has_key(table):
+ if table not in self.__tablecolumns:
self.__load_column_info(table)
if columns is None:
columns = self.__tablecolumns[table]
argument and returning a boolean.
"""
# check the validity of each column name
- if not self.__tablecolumns.has_key(table):
+ if table not in self.__tablecolumns:
self.__load_column_info(table)
if columns is None:
columns = self.tablecolumns[table]
# extract the rowid from the key
rowid = key[-_rowid_str_len:]
- if not rejected_rowids.has_key(rowid):
+ if rowid not in rejected_rowids:
# if no condition was specified or the condition
# succeeds, add row to our match list.
if not condition or condition(data):
- if not matching_rowids.has_key(rowid):
+ if rowid not in matching_rowids:
matching_rowids[rowid] = {}
if savethiscolumndata:
matching_rowids[rowid][column] = data
else:
- if matching_rowids.has_key(rowid):
+ if rowid in matching_rowids:
del matching_rowids[rowid]
rejected_rowids[rowid] = rowid
if len(columns) > 0:
for rowid, rowdata in matching_rowids.items():
for column in columns:
- if rowdata.has_key(column):
+ if column in rowdata:
continue
try:
rowdata[column] = self.db.get(
txn.commit()
txn = None
- if self.__tablecolumns.has_key(table):
+ if table in self.__tablecolumns:
del self.__tablecolumns[table]
except DBError, dberror:
def populateDB(self, _txn=None):
d = self.d
- for x in range(self._numKeys/2):
+ for x in range(self._numKeys//2):
key = '%04d' % (self._numKeys - x) # insert keys in reverse order
data = self.makeData(key)
d.put(key, data, _txn)
d.put('empty value', '', _txn)
- for x in range(self._numKeys/2-1):
+ for x in range(self._numKeys//2-1):
key = '%04d' % x # and now some in forward order
data = self.makeData(key)
d.put(key, data, _txn)
if db.version() >= (4,0):
statDict = self.env.log_stat(0);
- assert statDict.has_key('magic')
- assert statDict.has_key('version')
- assert statDict.has_key('cur_file')
- assert statDict.has_key('region_nowait')
+ assert 'magic' in statDict
+ assert 'version' in statDict
+ assert 'cur_file' in statDict
+ assert 'region_nowait' in statDict
# must have at least one log file present:
logs = self.env.log_archive(db.DB_ARCH_ABS | db.DB_ARCH_LOG)