def renderHTTP(self, ctx): inevow.IRequest(ctx).setResponseCode(404) # Look for an application-remembered handler try: notFoundHandler = ctx.locate(inevow.ICanHandleNotFound) except KeyError as e: return self.notFound # Call the application-remembered handler but if there are any errors # then log it and fallback to the standard message. try: return notFoundHandler.renderHTTP_notFound(PageContext(parent=ctx, tag=notFoundHandler)) except: log.err() return self.notFound
def renderHTTP(self, ctx): inevow.IRequest(ctx).setResponseCode(404) # Look for an application-remembered handler try: notFoundHandler = ctx.locate(inevow.ICanHandleNotFound) except KeyError as e: return self.notFound # Call the application-remembered handler but if there are any errors # then log it and fallback to the standard message. try: return notFoundHandler.renderHTTP_notFound( PageContext(parent=ctx, tag=notFoundHandler)) except: log.err() return self.notFound
class FourOhFour: """A simple 404 (not found) page. """ implements(inevow.IResource) notFound = "<html><head><title>Page Not Found</title></head><body>Sorry, but I couldn't find the object you requested.</body></html>" original = None def locateChild(self, ctx, segments): return NotFound def renderHTTP(self, ctx): inevow.IRequest(ctx).setResponseCode(404) # Look for an application-remembered handler try: notFoundHandler = ctx.locate(inevow.ICanHandleNotFound) except KeyError, e: return self.notFound # Call the application-remembered handler but if there are any errors # then log it and fallback to the standard message. try: return notFoundHandler.renderHTTP_notFound( PageContext(parent=ctx, tag=notFoundHandler)) except: log.err() return self.notFound
class FourOhFour: """A simple 404 (not found) page. """ __implements__ = inevow.IResource, notFound = "<html><head><title>Page Not Found</title><head><body>Sorry, but I couldn't find the object you requested.</body></html>" original = None def locateChild(self, ctx, segments): return NotFound def renderHTTP(self, ctx): from twisted.protocols import http inevow.IRequest(ctx).setResponseCode(404) try: notFoundHandler = ctx.locate(inevow.ICanHandleNotFound) return notFoundHandler.renderHTTP_notFound(PageContext(parent=ctx, tag=notFoundHandler)) except KeyError, e: return self.notFound except: log.err() return self.notFound def __nonzero__(self): return False # Not found singleton NotFound = None, ()
class FourOhFour: """A simple 404 (not found) page. """ __implements__ = inevow.IResource, notFound = "<html><head><title>Page Not Found</title><head><body>Sorry, but I couldn't find the object you requested.</body></html>" original = None def locateChild(self, ctx, segments): return NotFound def renderHTTP(self, ctx): from twisted.protocols import http inevow.IRequest(ctx).setResponseCode(404) try: notFoundHandler = ctx.locate(inevow.ICanHandleNotFound) return notFoundHandler.renderHTTP_notFound( PageContext(parent=ctx, tag=notFoundHandler)) except KeyError, e: return self.notFound except: log.err() return self.notFound def __nonzero__(self): return False # Not found singleton NotFound = None, ()