kevin1024/vcrpy — pull request #103 by IvanMalison (2014-09-17 06:50:53+00:00)
Title: Add use_cassette class so functinos that are decorated with use_cassette...

... can be called multiple times.

Closes #102

I got rid of the use of ContextDecorator because I looked at that code an decided that its pretty terrible. The only reason that you might prefer their call
```python
def __call__(self, f):
@wraps(f)
def inner(*args, **kw):
self.__enter__()

exc = _NO_EXCEPTION
try:
result = f(*args, **kw)
except Exception:
exc = sys.exc_info()

catch = self.__exit__(*exc)

if not catch and exc is not _NO_EXCEPTION:
_reraise(*exc)
return result
return inner
```

to the call that I provided

```python
def __call__(self, function):
@functools.wraps(function)
def wrapped(*args, **kwargs):
with self:
return function(*args, **kwargs)
return wrapped
```

Is if you want to support python 2.4 (which has decorators but not context managers). It doesn't seem like this library is aimed at python 2.4 users so I think the implementation I provided should be preferred.