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/CALiRuxkN_HqTAyLv-TThmc4WU4Fvh_5X%3D5T6KmEJ_BHFUE%2B44w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.