Turbogears2 migration: custom error pages

Thomas De Schampheleire patrickdepinguin at gmail.com
Wed Feb 17 21:36:36 UTC 2016


Hi Alessandro,

I noticed that our custom error pages (e.g. on 404) do not work.
Based on the documentation and a quickstart project I have the
impression that this should 'just work' without specific configuration
in the project.

I verified the configuration values on a running system, and they seem
correct for the 404 that I'm generating:

 'status_code_redirect': False,
 'errorpage.enabled': True,
 'errorpage.status_codes': [403, 404, 401],


Here is the full log of a request to /unexisting :


2016-02-17 22:32:15.170 DEBUG [kallithea.lib.middleware.simplegit]
pathinfo: /unexisting detected as Git False
2016-02-17 22:32:15.171 DEBUG [kallithea.lib.middleware.simplehg]
pathinfo: /unexisting detected as Mercurial False
2016-02-17 22:32:15.252 DEBUG [routes.middleware] No route matched for
GET /unexisting
2016-02-17 22:32:15.255 DEBUG [kallithea.lib.auth_modules] Importing
kallithea.lib.auth_modules.auth_internal
2016-02-17 22:32:15.255 DEBUG [kallithea.lib.auth_modules] Loaded auth
plugin from kallithea.lib.auth_modules.auth_internal
(module:kallithea.lib.auth_modules.auth_internal,
file:/home/tdescham/repo/contrib/kallithea/kallithea-tg/kallithea/lib/auth_modules/auth_internal.pyc)
2016-02-17 22:32:15.255 DEBUG [kallithea.lib.auth_modules] Importing
kallithea.lib.auth_modules.auth_ldap
2016-02-17 22:32:15.255 DEBUG [kallithea.lib.auth_modules] Loaded auth
plugin from kallithea.lib.auth_modules.auth_ldap
(module:kallithea.lib.auth_modules.auth_ldap,
file:/home/tdescham/repo/contrib/kallithea/kallithea-tg/kallithea/lib/auth_modules/auth_ldap.pyc)
2016-02-17 22:32:15.257 DEBUG [kallithea.lib.auth] Auth User lookup by
database user None
2016-02-17 22:32:15.257 DEBUG [kallithea.lib.auth] filling
<User('id:1:default')> data
2016-02-17 22:32:15.258 DEBUG [kallithea.lib.auth] Auth User is now
<AuthUser('id:1[default] auth:True')>
2016-02-17 22:32:15.258 INFO  [kallithea.lib.base] IP: 127.0.0.1 User:
<AuthUser('id:1[default] auth:True')> accessed /unexisting
2016-02-17 22:32:15.264 DEBUG [kallithea.lib.auth_modules] Importing
kallithea.lib.auth_modules.auth_internal
2016-02-17 22:32:15.265 DEBUG [kallithea.lib.auth_modules] Loaded auth
plugin from kallithea.lib.auth_modules.auth_internal
(module:kallithea.lib.auth_modules.auth_internal,
file:/home/tdescham/repo/contrib/kallithea/kallithea-tg/kallithea/lib/auth_modules/auth_internal.pyc)
2016-02-17 22:32:15.265 DEBUG [kallithea.lib.auth_modules] Importing
kallithea.lib.auth_modules.auth_ldap
2016-02-17 22:32:15.265 DEBUG [kallithea.lib.auth_modules] Loaded auth
plugin from kallithea.lib.auth_modules.auth_ldap
(module:kallithea.lib.auth_modules.auth_ldap,
file:/home/tdescham/repo/contrib/kallithea/kallithea-tg/kallithea/lib/auth_modules/auth_ldap.pyc)
2016-02-17 22:32:15.265 DEBUG [kallithea.lib.auth] Auth User lookup by
database user None
2016-02-17 22:32:15.265 DEBUG [kallithea.lib.auth] filling
<User('id:1:default')> data
2016-02-17 22:32:15.266 DEBUG [kallithea.lib.auth] Auth User is now
<AuthUser('id:1[default] auth:True')>
2016-02-17 22:32:15.266 INFO  [kallithea.lib.base] IP: 127.0.0.1 User:
<AuthUser('id:1[default] auth:True')> accessed /error/document
2016-02-17 22:32:15.271 DEBUG [kallithea.SimpleHg] Request time: 0.100s
2016-02-17 22:32:15.271 DEBUG [kallithea.SimpleGit] Request time: 0.101s


The contents of base_config (the instance of KallitheaAppConfig) are:

{'DBSession': <sqlalchemy.orm.scoping.ScopedSession object at 0x7f465d15fd10>,
 'app_globals': None,
 'application_wrappers': [<class 'tg.appwrappers.i18n.I18NApplicationWrapper'>,
                          <class
'tg.appwrappers.identity.IdentityApplicationWrapper'>,
                          <class
'tg.appwrappers.session.SessionApplicationWrapper'>,
                          <class
'tg.appwrappers.caching.CacheApplicationWrapper'>,
                          <class
'tg.appwrappers.mingflush.MingApplicationWrapper'>,
                          <class
'tg.appwrappers.transaction_manager.TransactionApplicationWrapper'>,
                          <class
'tg.appwrappers.errorpage.ErrorPageApplicationWrapper'>],
 'application_wrappers_dependencies': {None: [],
                                       False: [],
                                       True: [<class
'tg.appwrappers.i18n.I18NApplicationWrapper'>,
                                              <class
'tg.appwrappers.identity.IdentityApplicationWrapper'>,
                                              <class
'tg.appwrappers.session.SessionApplicationWrapper'>,
                                              <class
'tg.appwrappers.caching.CacheApplicationWrapper'>,
                                              <class
'tg.appwrappers.mingflush.MingApplicationWrapper'>,
                                              <class
'tg.appwrappers.transaction_manager.TransactionApplicationWrapper'>,
                                              <class
'tg.appwrappers.errorpage.ErrorPageApplicationWrapper'>]},
 'auth_backend': None,
 'auto_reload_templates': True,
 'cache.enabled': True,
 'call_on_shutdown': [],
 'call_on_startup': [],
 'controller_caller': <function call_controller at 0x7f465f1d3b18>,
 'controller_wrappers': [],
 'custom_tw2_config': {},
 'default_renderer': 'mako',
 'disable_request_extensions': False,
 'dispatch_path_translator': True,
 'enable_routing_args': False,
 'errorpage.enabled': True,
 'errorpage.status_codes': [403, 404, 401],
 'helpers': None,
 'i18n.enabled': True,
 'mimetypes': <mimetypes.MimeTypes instance at 0x7f465cd545f0>,
 'ming.autoflush': False,
 'model': <module 'kallithea.model' from
'/home/tdescham/repo/contrib/kallithea/kallithea-tg/kallithea/model/__init__.pyc'>,
 'package': <module 'kallithea' from
'/home/tdescham/repo/contrib/kallithea/kallithea-tg/kallithea/__init__.pyc'>,
 'package_name': 'kallithea',
 'paths': {'controllers':
'/home/tdescham/repo/contrib/kallithea/kallithea-tg/kallithea/controllers',
           'root':
'/home/tdescham/repo/contrib/kallithea/kallithea-tg/kallithea',
           'static_files':
'/home/tdescham/repo/contrib/kallithea/kallithea-tg/kallithea/public',
           'templates':
['/home/tdescham/repo/contrib/kallithea/kallithea-tg/kallithea/templates']},
 'prefer_toscawidgets2': False,
 'registry_streaming': True,
 'render_functions': {'json': <function render_json at 0x7f465f6df9b0>,
                      'jsonp': <function render_jsonp at 0x7f465f6dfa28>,
                      'mako': <tg.renderers.mako.MakoRenderer object
at 0x7f465cdc14d0>},
 'renderers': ['json', 'mako'],
 'rendering_engines': {'genshi': <class 'tg.renderers.genshi.GenshiRenderer'>,
                       'jinja': <class 'tg.renderers.jinja.JinjaRenderer'>,
                       'json': <class 'tg.renderers.json.JSONRenderer'>,
                       'jsonp': <class 'tg.renderers.json.JSONRenderer'>,
                       'kajiki': <class 'tg.renderers.kajiki.KajikiRenderer'>,
                       'mako': <class 'tg.renderers.mako.MakoRenderer'>},
 'rendering_engines_options': {'genshi': {'content_type': 'text/html'},
                               'jinja': {'content_type': 'text/html'},
                               'json': {'content_type': 'application/json'},
                               'jsonp': {'content_type':
'application/javascript'},
                               'kajiki': {'content_type': 'text/html'},
                               'mako': {'content_type': 'text/html'}},
 'rendering_engines_without_vars': set(['json', 'jsonp']),
 'sa_auth': {},
 'serve_static': True,
 'session.data_serializer': 'json',
 'session.enabled': True,
 'status_code_redirect': False,
 'tm.enabled': True,
 'use_dotted_templatenames': False,
 'use_ming': False,
 'use_sqlalchemy': True,
 'use_toscawidgets': False,
 'use_toscawidgets2': False}



Do you have some idea on what is wrong, or can you guide me in the
right direction?

Thanks,
Thomas


More information about the kallithea-general mailing list