Merge "pep8 db.py"

This commit is contained in:
Jenkins 2012-11-26 23:59:00 +00:00 committed by Gerrit Code Review
commit 2ad23a25e8

View File

@ -243,7 +243,8 @@ class DatabaseBroker(object):
if os.path.exists(self.db_file): if os.path.exists(self.db_file):
# It's as if there was a "condition" where different parts # It's as if there was a "condition" where different parts
# of the system were "racing" each other. # of the system were "racing" each other.
raise DatabaseConnectionError(self.db_file, raise DatabaseConnectionError(
self.db_file,
'DB created by someone else while working?') 'DB created by someone else while working?')
renamer(tmp_db_file, self.db_file) renamer(tmp_db_file, self.db_file)
self.conn = get_db_connection(self.db_file, self.timeout) self.conn = get_db_connection(self.db_file, self.timeout)
@ -285,7 +286,8 @@ class DatabaseBroker(object):
dbs_path = os.path.dirname(partition_path) dbs_path = os.path.dirname(partition_path)
device_path = os.path.dirname(dbs_path) device_path = os.path.dirname(dbs_path)
quar_path = os.path.join(device_path, 'quarantined', quar_path = os.path.join(device_path, 'quarantined',
self.db_type + 's', os.path.basename(self.db_dir)) self.db_type + 's',
os.path.basename(self.db_dir))
try: try:
renamer(self.db_dir, quar_path) renamer(self.db_dir, quar_path)
except OSError, e: except OSError, e:
@ -808,9 +810,11 @@ class ContainerBroker(DatabaseBroker):
try: try:
(name, timestamp, size, content_type, etag, (name, timestamp, size, content_type, etag,
deleted) = pickle.loads(entry.decode('base64')) deleted) = pickle.loads(entry.decode('base64'))
item_list.append({'name': name, 'created_at': item_list.append({'name': name,
timestamp, 'size': size, 'content_type': 'created_at': timestamp,
content_type, 'etag': etag, 'size': size,
'content_type': content_type,
'etag': etag,
'deleted': deleted}) 'deleted': deleted})
except Exception: except Exception:
self.logger.exception( self.logger.exception(
@ -1334,7 +1338,8 @@ class AccountBroker(DatabaseBroker):
(name, put_timestamp, delete_timestamp, (name, put_timestamp, delete_timestamp,
object_count, bytes_used, deleted) = \ object_count, bytes_used, deleted) = \
pickle.loads(entry.decode('base64')) pickle.loads(entry.decode('base64'))
item_list.append({'name': name, item_list.append(
{'name': name,
'put_timestamp': put_timestamp, 'put_timestamp': put_timestamp,
'delete_timestamp': delete_timestamp, 'delete_timestamp': delete_timestamp,
'object_count': object_count, 'object_count': object_count,