I have this decorator, used to decorate a django view when I do not want the view to be executed if the share
argument is True
(handled by middleware)
class no_share(object):
def __init__(self, view):
self.view = view
def __call__(self, request, *args, **kwargs):
"""Don't let them in if it's shared"""
if kwargs.get('shared', True):
from django.http import Http404
raise Http404('not availiable for sharing')
return self.view(request, *args, **kwargs)
It currently works like this:
@no_share
def prefs(request, [...])
But I'm wanting to expand the functionality a little bit, so that it will work like this:
@no_share('prefs')
def prefs(request, [...])
My question is how can I modify this decorator class so that it accepts extra arguments?