Commits

Robert Brewer committed e68e630

NotFound path arg now defaults to cherrypy.request.path.

  • Participants
  • Parent commits bb06c24

Comments (0)

Files changed (2)

cherrypy/_cperror.py

 class NotFound(HTTPError):
     """ Happens when a URL couldn't be mapped to any class.method """
     
-    def __init__(self, path):
+    def __init__(self, path=None):
+        if path is None:
+            path = cherrypy.request.path
         self.args = (path,)
         HTTPError.__init__(self, 404, "The path %s was not found." % repr(path))
-
+
 
 class InternalError(HTTPError):
     """ Error that should never happen """

cherrypy/lib/cptools.py

                     return self.index(*args, **kwargs)
                 except TypeError:
                     pass
-            raise cherrypy.NotFound(cherrypy.request.path)
+            raise cherrypy.NotFound()
     default.exposed = True
 
 
     except OSError:
         if getattr(cherrypy, "debug", None):
             cherrypy.log("    NOT FOUND file: %s" % path, "DEBUG")
-        raise cherrypy.NotFound(cherrypy.request.path)
+        raise cherrypy.NotFound()
     
     if contentType is None:
         # Set content-type based on filename extension