On Nov 6, 2007, at 5:16 AM, Max Ischenko wrote:

> Hello,
>
> I want to write a generic error handler which will display  
> meaningful page to the user in case some particular error occurs.
>
> I have tried to override WSGIController.__call__ using the  
> following code but it doesn't work:
>
>         try:
>             return WSGIController.__call__(self, environ,  
> start_response)
>         except model.SQLError, e:
>             c.message = e
>             c.code = 500
>             return render('/custom_error.html')
>
> When executed it simply prints a traceback to stderr:
>
>   File "/usr/lib/python2.5/site-packages/Paste-1.4-py2.5.egg/paste/ 
> httpserver.py", line 287, in wsgi_execute
>     self.wsgi_start_response)
>   File "/usr/lib/python2.5/site-packages/Paste-1.4-py2.5.egg/paste/ 
> translogger.py", line 67, in __call__
>     return self.application(environ, replacement_start_response)
>   File "/usr/lib/python2.5/site-packages/Paste-1.4-py2.5.egg/paste/ 
> debug/prints.py", line 98, in __call__
>     environ, self.app)
>   File "/usr/lib/python2.5/site-packages/Paste-1.4-py2.5.egg/paste/ 
> wsgilib.py", line 540, in intercept_output
>     if data[0] is None:
> IndexError: list index out of range
>

__call__ is the outer realm of Pylons Controllers -- its result are  
returned directly to the PylonsBaseWSGIApp. What it expects from the  
Controller is either a Pylons/Paste response object (that is,  
Controller does the work of grabbing the global pylons.response and  
returning that), or a typical WSGI response.


--
Philip Jenvey



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to