Commits

Anonymous committed 3c611f7

Fix for #336. Corrected docstring and replaced use of cherrypy.lib.httptools.redirect with cherrypy.HTTPRedirect.

Comments (0)

Files changed (1)

cherrypy/lib/filter/sessionauthenticatefilter.py

 
 class SessionAuthenticateFilter(BaseFilter):
     """
-    Filter that adds debug information to the page
+    Filter allows for simple forms based authentication and access control
     """
 
     def beforeMain(self):
         if not cherrypy.config.get('sessionAuthenticateFilter.on', False):
             return
         
-        from cherrypy.lib import httptools
         
         checkLoginAndPassword = cherrypy.config.get('sessionAuthenticateFilter.checkLoginAndPassword', defaultCheckLoginAndPassword)
         loginScreen = cherrypy.config.get('sessionAuthenticateFilter.loginScreen', defaultLoginScreen)
             cherrypy.session[sessionKey] = None
             cherrypy.request.user = None
             fromPage = cherrypy.request.paramMap.get('fromPage', '..')
-            cherrypy.response.body = httptools.redirect(fromPage)
+            raise cherrypy.HTTPRedirect(fromPage)
         elif cherrypy.request.path.endswith('doLogin'):
             fromPage = cherrypy.request.paramMap.get('fromPage', '..')
             login = cherrypy.request.paramMap['login']
                 cherrypy.session[sessionKey] = login
                 if not fromPage:
                     fromPage = '/'
-                cherrypy.response.body = httptools.redirect(fromPage)
+                raise cherrypy.HTTPRedirect(fromPage)
             return
 
         # Check if user is logged in