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

2018-01-28 Thread Bert JW Regeer
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.troe...@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  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-discuss+unsubscr...@googlegroups.com.
> To post to this group, send email to pylons-discuss@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.

-- 
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-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/69309CE5-ADCD-4BB9-9F92-31BE51DA4BF7%400x58.com.
For more options, visit https://groups.google.com/d/optout.


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

2018-01-27 Thread jens . troeger
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 ** 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-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@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.