aboutsummaryrefslogtreecommitdiff
path: root/budget/utils.py
diff options
context:
space:
mode:
authorArnaud Bos <arnaud.tlse@gmail.com>2011-09-18 23:38:12 +0200
committerArnaud Bos <arnaud.tlse@gmail.com>2011-09-18 23:39:10 +0200
commit681f22f3e47c3fb75fdb1d858b179e945c952596 (patch)
treee83246b13d33f30083488b6913e96e261605f5e3 /budget/utils.py
parent89e1bbe134bc770d4a3f999a1329bd07522b07cf (diff)
parent20ab40690d74befcd8fc75f24f301759840bf43a (diff)
downloadihatemoney-mirror-681f22f3e47c3fb75fdb1d858b179e945c952596.zip
ihatemoney-mirror-681f22f3e47c3fb75fdb1d858b179e945c952596.tar.gz
ihatemoney-mirror-681f22f3e47c3fb75fdb1d858b179e945c952596.tar.bz2
Merge branch 'master' into auth-forms-usability
Diffstat (limited to 'budget/utils.py')
-rw-r--r--budget/utils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/budget/utils.py b/budget/utils.py
index f4003eb..88b8580 100644
--- a/budget/utils.py
+++ b/budget/utils.py
@@ -1,5 +1,7 @@
import re
from functools import wraps
+import inspect
+
from flask import redirect, url_for, session, request
from werkzeug.routing import HTTPException, RoutingException
@@ -29,3 +31,12 @@ class Redirect303(HTTPException, RoutingException):
def get_response(self, environ):
return redirect(self.new_url, 303)
+
+def for_all_methods(decorator):
+ """Apply a decorator to all the methods of a class"""
+ def decorate(cls):
+ for name, method in inspect.getmembers(cls, inspect.ismethod):
+ setattr(cls, name, decorator(method))
+ return cls
+ return decorate
+