From a139465512d909adec8be040fdd43c8ba229ce01 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Tue, 28 Oct 2014 12:49:02 -0700 Subject: [PATCH] check if 'sync' method actually exists before calling -- anydbm does not have sync() method --- warcprox/warcprox.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/warcprox/warcprox.py b/warcprox/warcprox.py index 5196614..25bf1eb 100644 --- a/warcprox/warcprox.py +++ b/warcprox/warcprox.py @@ -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):