check if 'sync' method actually exists before calling -- anydbm does not have sync()

method
This commit is contained in:
Ilya Kreymer 2014-10-28 12:49:02 -07:00
parent a0a5ef2355
commit a139465512

View File

@ -689,7 +689,8 @@ class DedupDb(object):
self.db.close()
def sync(self):
self.db.sync()
if hasattr(self.db, 'sync'):
self.db.sync()
def save(self, key, response_record, offset):
record_id = response_record.get_header(warctools.WarcRecord.ID).decode('latin1')
@ -999,7 +1000,8 @@ class PlaybackIndexDb(object):
def sync(self):
self.db.sync()
if hasattr(self.db, 'sync'):
self.db.sync()
def save(self, warcfile, recordset, offset):