Bug #567
pagemaker init exception triggers no content error, not debug screen
Description
An error in a pageMaker init triggers no content to be send to the browser, and not the expected debugging page.
The log says:
Exception happened during processing of request from [ip/port].
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 284, in handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 310, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 639, in init
self.handle()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 343, in handle
self.handle_one_request()
File "/home/janklopper/underdark/libs/uweb/standalone.py", line 84, in handle_one_request
self.server.router(self)
File "/home/janklopper/underdark/libs/uweb/_init__.py", line 106, in RequestHandler
pages = page_class(req, config=config)
File "/home/janklopper/underdark/floes/pages/search.py", line 20, in init
self.connection.cursor.Execute('use floes_manager')
File "/home/janklopper/underdark/libs/uweb/pagemaker/__init__.py", line 372, in connection
mysqlopts = self.options['mysql']
KeyError: 'mysql'
Associated revisions
History
#1 Updated by Elmer de Looff almost 13 years ago
- Category set to PageMaker
- Status changed from New to Resolved
- Assignee changed from Elmer de Looff to Jan Klopper
- % Done changed from 0 to 70
When the PageMaker
init fails, there is nothing to generate a page with, so a lack of response to the client is unfortunate, but also unavoidable.
What I've added to BasePageMaker
is a _PostInit
that gets called by the handler after the PageMaker object has been created. Using this method, it can be assured that PageMaker will not suddenly crash during initialization, and that should things break during _PostInit, the appropriate error pages can be returned.
Of course, if there are errors in handling the error page, the client will again receive nothing. If this proves to be a problem, a separate issue (referencing this one) should be created for that.
#2 Updated by Jan Klopper almost 13 years ago
- Priority changed from Low to Normal
Ill close this when we document this behaviour in the uweb documentation.
#3 Updated by Elmer de Looff almost 13 years ago
Applied in changeset commit:25bc04d1b66c.
#4 Updated by Elmer de Looff almost 13 years ago
Applied in changeset commit:7633f749e1d7.
#5 Updated by Elmer de Looff almost 13 years ago
Applied in changeset 8f14eb86cb04.
#6 Updated by Jan Klopper over 12 years ago
- Status changed from Resolved to Closed
- Assignee changed from Jan Klopper to Elmer de Looff
- % Done changed from 70 to 100
This seems to work just fine now, thnx
Created a _PostInit() method that gets called after the PageMaker object has been successfully created. This means we have a PageMaker init method that is guaranteed to succeed, and any errors from _PostInit() can be handled by the existing PageMaker. This resolves #567. Also fixed a missing newline on the error written to the standalone error log.