Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

newforms-admin: Fixed #7553 -- Reverted [7824] in favor of a better f…

…ix in #7553. The never_cache decorator is no longer special casing None. Thanks Michael Newman for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7933 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 885ade77846f720c553e449947a2148f58e85577 1 parent 83afd39
Brian Rosner authored July 16, 2008
12  django/contrib/admin/sites.py
@@ -118,14 +118,10 @@ def root(self, request, url):
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 permission to continue or display 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)
@@ -262,7 +258,7 @@ def login(self, request):
262 258
                         # overwrite request.POST with the saved post_data, and continue
263 259
                         request.POST = post_data
264 260
                         request.user = user
265  
-                        return None
  261
+                        return self.root(request, request.path.split(self.root_path)[-1])
266 262
                     else:
267 263
                         request.session.delete_test_cookie()
268 264
                         return http.HttpResponseRedirect(request.path)
5  django/views/decorators/cache.py
@@ -42,9 +42,6 @@ def never_cache(view_func):
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)

0 notes on commit 885ade7

Please sign in to comment.
Something went wrong with that request. Please try again.