You should be able to go with:
import transaction
for attempt in transaction.attempts(3):
[...]
It should also be possible to extend it to all your controllers by
using a controller_wrapper.
Simple add to your config/app_cfg.py something like:
def transactions_retry_wrapper(app_config, controller):
def wrapped_controller(*args, **kw):
for attempt in transaction.attempts(3):
return controller(*args, **kw)
return wrapped_controller
base_config.register_hook('controller_wrapper', transactions_retry_wrapper)
Just keep in mind that controller wrappers are a recent addition, I'm
sure they are available on 2.2 and 2.1.5, but I don't remember if they
are on 2.1.4
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To view this discussion on the web visit
>
https://groups.google.com/d/msg/turbogears/-/5T23ID0fzmgJ.
> To post to this group, send email to
turbo...@googlegroups.com.
> To unsubscribe from this group, send email to
>
turbogears+...@googlegroups.com.
> For more options, visit this group at
>
http://groups.google.com/group/turbogears?hl=en.