Merge pull request #398 from rscholer/imap-socket
imap - Catch socket.gaierror if no internet connection is available.
This commit is contained in:
commit
1051b76251
@ -54,9 +54,14 @@ class IMAP(Backend):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def unread(self):
|
def unread(self):
|
||||||
conn = self.get_connection()
|
try:
|
||||||
self.last = len(conn.search(None, "UnSeen")[1][0].split())
|
conn = self.get_connection()
|
||||||
return self.last
|
except socket.gaierror:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
self.last = len(conn.search(None, "UnSeen")[1][0].split())
|
||||||
|
finally:
|
||||||
|
return self.last
|
||||||
|
|
||||||
|
|
||||||
Backend = IMAP
|
Backend = IMAP
|
||||||
|
Loading…
Reference in New Issue
Block a user