Ticket #16626: login_required.diff
File login_required.diff, 1.3 KB (added by , 13 years ago) |
---|
-
django/views/generic/base.py
4 4 from django.template.response import TemplateResponse 5 5 from django.utils.log import getLogger 6 6 from django.utils.decorators import classonlymethod 7 from django.contrib.auth.decorators import login_required 7 8 8 9 logger = getLogger('django.request') 9 10 … … 13 14 Intentionally simple parent class for all views. Only implements 14 15 dispatch-by-method and simple sanity checking. 15 16 """ 17 login_required = False 16 18 17 19 http_method_names = ['get', 'post', 'put', 'delete', 'head', 'options', 'trace'] 18 20 … … 43 45 44 46 def view(request, *args, **kwargs): 45 47 self = cls(**initkwargs) 48 49 @login_required 50 def login_required_dispatch(request, *args, **kwargs): 51 """ 52 Wrapper on dispatch method used for login_required decorator. 53 """ 54 return self.dispatch(request, *args, **kwargs) 55 56 if self.login_required: 57 return login_required_dispatch(request, *args, **kwargs) 46 58 return self.dispatch(request, *args, **kwargs) 47 59 48 60 # take name and docstring from class