Re: [pylons-discuss] Confused with parameter `request` in exception views.

10 views
Skip to first unread message

Bert JW Regeer

unread,
Jan 28, 2018, 3:14:18 PM1/28/18
to pylons-...@googlegroups.com
Hey,

This is a known issue with the way we add new attributes and functions to the request object. pyramid.util.Request does not exist. pyramid.request.Request is still the underlying object.

This has been fixed in https://github.com/Pylons/pyramid/pull/3129.

Bert

> On Jan 27, 2018, at 14:01, jens.t...@gmail.com wrote:
>
> Hello,
>
> Following the examples of how to implement an exception view (see here or here), I have the following code:
>
> @view_config(
> context=Exception,
> permission=NO_PERMISSION_REQUIRED,
> )
> def handle_exception(exc, request):
> """Last resort to handle view exceptions."""
> …
>
> However, as it turns out the `request` parameter passed into the above view function is a <class 'pyramid.util.Request'> and not an instance of pyramid.request.Request. Yet, printing the request parameter dumps request information.
>
> It would be good if the documentation would shed more light on this behavior. I had assumed that the request parameter is the same Request instance from the view function where the exception was raised. But that seems not to be the case?
>
> Thanks,
> Jens
>
> --
> You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discus...@googlegroups.com.
> To post to this group, send email to pylons-...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/30257edc-8516-44cb-ac6d-a02d8107565f%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages