Ticket #7553: 7553-sites-decorators-ref.2.diff
File 7553-sites-decorators-ref.2.diff, 2.5 KB (added by , 16 years ago) |
---|
-
django/views/decorators/cache.py
42 42 """ 43 43 def _wrapped_view_func(request, *args, **kwargs): 44 44 response = view_func(request, *args, **kwargs) 45 # Although rare, it is possible for a view to return None (e.g. the 46 # django.contrib.admin.sites.AdminSite.login view in one corner-case) 47 if response: 48 add_never_cache_headers(response) 45 add_never_cache_headers(response) 49 46 return response 50 47 return wraps(view_func)(_wrapped_view_func) -
django/contrib/admin/sites.py
118 118 # The 'logout' view doesn't require that the person is logged in. 119 119 if url == 'logout': 120 120 return self.logout(request) 121 121 122 # Check for permission or show login form 122 123 if not self.has_permission(request): 123 response = self.login(request) 124 if response: 125 # make sure that there is a response before returning 126 # this addresses any post data that might persist from 127 # expired sessions and continue through (#5999) 128 return response 124 return self.login(request) 129 125 130 126 if url == '': 131 127 return self.index(request) … … 257 253 user.last_login = datetime.datetime.now() 258 254 user.save() 259 255 if request.POST.has_key('post_data'): 256 request.session.delete_test_cookie() 260 257 post_data = _decode_post_data(request.POST['post_data']) 261 258 if post_data and not post_data.has_key(LOGIN_FORM_KEY): 262 259 # overwrite request.POST with the saved post_data, and continue 263 260 request.POST = post_data 264 261 request.user = user 265 return None262 return self.root(request, request.path.split(self.root_path)[-1]) 266 263 else: 267 request.session.delete_test_cookie()268 264 return http.HttpResponseRedirect(request.path) 269 265 else: 270 266 return self.display_login_form(request, ERROR_MESSAGE)