Hi,

I will definitely take look at this.


On Monday, January 23, 2017 at 1:19:38 PM UTC-6, Kai Groner wrote:
>
> I found the data manager interface somewhat convoluted, so I wrote some 
> adapters that allow you to write datamanagers as generator functions 
> (similar to contextlib.contextmanager).
>
> @datamanager
> def transactionally_do_something():
>     try:
>         # BEGIN
>         yield
>         # VOTE
>         yield
>     except Exception:
>         # ABORT
>         raise
>     else:
>         # FINISH
>
> There's also a @commitmanager version which skips the BEGIN phase if you 
> have nothing to put there, and there are inline flavors of both for 
> attaching a one-off datamanager to the current transaction.
>
> https://gist.github.com/groner/ae63a62ded7d6dbdfb3397f264300b16
>
>
>
> Kai
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/54fe0c27-9b6d-4231-afd1-85c714455165%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to