Turbogears2 migration: custom error pages

Thomas De Schampheleire patrickdepinguin at gmail.com
Thu Feb 18 09:26:39 UTC 2016


On Thu, Feb 18, 2016 at 8:39 AM, Alessandro Molina
<alessandro.molina at gmail.com> wrote:
>
>
> On Wed, Feb 17, 2016 at 10:36 PM, Thomas De Schampheleire
> <patrickdepinguin at gmail.com> wrote:
>>
>> I noticed that our custom error pages (e.g. on 404) do not work.
>>
>> Do you have some idea on what is wrong, or can you guide me in the
>> right direction?
>
>
> When an error is detected TurboGears replaces the request with a request for
> /error/document.
> And that seems to be happening as your logs contain:
>
> 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
>
> Might it be related to the fact that ErrorController had an empty
> __before__? As in TG it is called _before probably you want to rename it as
> _before if you want to throw away the behaviour provided by BaseController.

I tried adding a _before with the same content (pass) as __before__
but it didn't help.


>
> If it still doesn't work you probably want to copy an error controller from
> a quickstarted project
> https://github.com/TurboGears/tg2devtools/blob/master/devtools/templates/turbogears/%2Bpackage%2B/controllers/error.py_tmpl
> and mount it inside RootController through standard TG routing
> https://github.com/TurboGears/tg2devtools/blob/master/devtools/templates/turbogears/%2Bpackage%2B/controllers/root.py_tmpl#L57
> just to test if it's a controller or configuration problem.

I replaced our error.py with the example, and added the 'error =
ErrorController()' line, but also no changes. I added a print in both
'def document', but it is never reached.

I also added a debug log in the BaseController, and that is also not
printed when accessing a non-existing page.

More ideas?


Btw, what exactly does this:

error = ErrorController()

in the root controller do? This was not obvious from the docs for me.
And in the kallithea port we are not using this mechanism to add
routes? How is it done instead?

Thanks,
Thomas


More information about the kallithea-general mailing list