Producer now works as a context manager.

This commit is contained in:
Ask Solem 2011-07-28 11:46:44 +01:00
parent 4faf662d4f
commit 65dc58505a
1 changed files with 6 additions and 0 deletions

View File

@ -138,6 +138,12 @@ class Producer(object):
self.channel = channel
self.exchange.revive(channel)
def __enter__(self):
return self
def __exit__(self, *exc_info):
self.close()
def close(self):
pass