daltonmatos/alchemytools — pull request #8 by etandel (2013-12-03 19:12:11+00:00)
Title: Make managed() function as decorator (plus bonus cosmetics).

The idea was to remove the with block from this common idiom

```python
def func(*args, **kwargs):
with managed(Session) as session:
func_body(session)
```
by making `managed()` function as a decorator to a function that receives the open session as an argument:

```python
@managed(Session)
def func(session, *args, **kwargs)
func_body(session)
```

Not that the session is opened each time `func()` is called and close when it returns (or raises an exception).