Skip to content

Commit

Permalink
updated the file permission error capture when reading subscribers as…
Browse files Browse the repository at this point in the history
… well
  • Loading branch information
hariharshankar committed Aug 12, 2014
1 parent 07d3146 commit 93a6b6b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions resourcesync_push/hub/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def read_subscriptions(self):
data = cPickle.load(sub_file)
except (IOError, EOFError) as err:
print(err)
return None
finally:
if sub_file:
sub_file.close()
Expand Down Expand Up @@ -132,6 +133,8 @@ def publish_push_payload(self, future_session, response):
"""

subscriptions = self.read_subscriptions()
if not subscriptions:
return self.respond(code=500, msg="Error reading subscriptions.")
subscribers = subscriptions.get(self.push_url, None)
if not subscribers:
return self.respond(code=204, msg="")
Expand Down Expand Up @@ -172,6 +175,8 @@ def handle_resourcesync_request(self, content_type="application/xml"):
msg="Topic is not registered with the hub.")

subscriptions = self.read_subscriptions()
if not subscriptions:
return self.respond(code=500, msg="Error reading subscriptions.")
subscribers = subscriptions.get(topic, None)
if not subscribers:
return self.respond(code=204)
Expand Down

0 comments on commit 93a6b6b

Please sign in to comment.