Is it possible to use Django (and self-made) view decorators with Piston handler methods? The problem is that with the methods, the first argument is self
(the handler) and the second the request
, while for the methods the first argument is the request
.
Basically I'd like to do something like this:
from piston.handler import BaseHandler
from django.contrib.auth.decorators import permission_required
class MyHandler(BaseHandler):
@permission_required(lambda u: u.is_staff or u.is_superuser)
def read(self, request, foo, bar):
# do something