<commit_before># -*- coding: utf-8 -*-
# Error controller implements nicer error pages
#   HTTP error codes and their descriptions - http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_Error

module = 'errors'

from gluon.http import defined_status
response.extra_styles = ['S3/errorpages.css']

def index():
    ''' default generic error page '''
    print foo
    try:
        code = request.vars['code']
        description = defined_status[int(code)]
    except KeyError:
        description = 'unknown error'
        code='NA'
        
    details = " %s, %s " % (code, description)
    message = "Oops! Something went wrong..."   <commit_msg>added routes.py configuration instructions on top of error controller<commit_after># -*- coding: utf-8 -*-
# HTTP Error handler -- implements nicer error pages
# 

# TODO: add/replace the following to your routes.py in web2py directory
#   routes_onerror = [
#       ('sahana/401', '/sahana/default/user/login'),
#       ('sahana/400', '/sahana/errors/e400'),
#       ('sahana/403', '/sahana/errors/e403'),
#       ('sahana/404', '/sahana/errors/e404'),
#       ('sahana/500', '/sahana/errors/e500'),
#       ('sahana/502', '/sahana/errors/e502'),
#       ('sahana/503', '/sahana/errors/e503'),
#       ('sahana/504', '/sahana/errors/e504'),
#       ('sahana/*', '/sahana/errors/index'),
#   ]
# NOTE: if sahana is installed elsewhere or exists under different name in applications folder,
#       just rename it in above list.

module = 'errors'

from gluon.http import defined_status
response.extra_styles = ['S3/errorpages.css']

def index():
    ''' default generic error page '''
    print foo
    try:
        code = request.vars['code']
        description = defined_status[int(code)]
    except KeyError:
        description = 'unknown error'
        code='NA'
        
    details = " %s, %s " % (code, description)
    message = "Oops! Something went wrong..."   
{'fraction_non_alphanumeric': 0.1483204134366925, 'fraction_numerical': 0.02635658914728682, 'mean_word_length': 2.926977687626775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2186021', 'n_tokens_mistral': 635, 'n_tokens_neox': 597, 'n_words': 157}