Coverage for poff/__init__.py : 71%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
else: app.config.from_envvar('POFF_CONFIG_FILE')
def teardown_appcontext(error): """ Commits the session if no error has occured, otherwise rollbacks. """ except Exception: # pylint: disable=broad-except # Whoopsie! We can't db.session.rollback() _logger.exception('Exception happened during teardown commit.') else: # We have an exception, but it has probably already been handled by the modroriate handlers, # so just rollback the session and ignore the error db.session.rollback()
def server_error(error): generic_error_handler(error) # Don't rely on any special mechanisms such as template loading or other resources, # as we don't know where the error is. return textwrap.dedent('''\ <!doctype html> <title>Internal Server Error</title> <h1>Internal Server Error</h1> <p> I'm very sorry to report this, but something has gone wrong on the server. If you have administrator access, check the logs for more details, otherwise you should probably gently notify your sysadmin of the failure. ''')
def default_context(): 'version': __version__, }
""" Log exception to the standard logger. """ log_msg = textwrap.dedent("""Error occured. Path: %s Params: %s HTTP Method: %s Client IP Address: %s User Agent: %s User Platform: %s User Browser: %s User Browser Version: %s HTTP Headers: %s Exception: %s """ % ( request.path, request.values, request.method, request.remote_addr, request.user_agent.string, request.user_agent.platform, request.user_agent.browser, request.user_agent.version, request.headers, exception ) ) _logger.exception(log_msg) |