diff options
author | Ask Solem <ask@celeryproject.org> | 2011-06-28 15:41:16 +0100 |
---|---|---|
committer | Ask Solem <ask@celeryproject.org> | 2011-06-28 15:41:16 +0100 |
commit | c3204c56fb59351257120b7fc7e94829b0332831 (patch) | |
tree | 158638952c494c1c2ca445f694667f3433dce981 /kombu/simple.py | |
parent | 480112b21f12ddbef68158bab4721554901f1345 (diff) | |
download | kombu-c3204c56fb59351257120b7fc7e94829b0332831.tar.gz |
SimpleQueue and SimpleBuffer can now be used as contexts
Diffstat (limited to 'kombu/simple.py')
-rw-r--r-- | kombu/simple.py | 6 |
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 |