+def redirect_on_get(action):
+ """
+ Decorator for a controller action. If the action is called with a GET
+ method, 302 redirect to the action specified.
+ """
+
+ @decorator
+ def redirect_on_get_wrap(func, *args, **kwargs):
+ if request.method == 'GET':
+ controller = request.environ['pylons.routes_dict']['controller']
+ return h.redirect_to(controller=controller, action=action)
+ else:
+ return func(*args, **kwargs)
+ return redirect_on_get_wrap
+
+