summaryrefslogtreecommitdiff
path: root/kombu/simple.py
diff options
context:
space:
mode:
authorAsk Solem <ask@celeryproject.org>2011-06-28 15:41:16 +0100
committerAsk Solem <ask@celeryproject.org>2011-06-28 15:41:16 +0100
commitc3204c56fb59351257120b7fc7e94829b0332831 (patch)
tree158638952c494c1c2ca445f694667f3433dce981 /kombu/simple.py
parent480112b21f12ddbef68158bab4721554901f1345 (diff)
downloadkombu-c3204c56fb59351257120b7fc7e94829b0332831.tar.gz
SimpleQueue and SimpleBuffer can now be used as contexts
Diffstat (limited to 'kombu/simple.py')
-rw-r--r--kombu/simple.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/kombu/simple.py b/kombu/simple.py
index da54b708..f473aaa3 100644
--- a/kombu/simple.py
+++ b/kombu/simple.py
@@ -21,6 +21,12 @@ from kombu import messaging
class SimpleBase(object):
_consuming = False
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *exc_info):
+ self.close()
+
def __init__(self, channel, producer, consumer, no_ack=False,
channel_autoclose=False):
self.channel = channel