I don't have a complete answer to this, but the Request docstring says
that 'root', 'registry', and a few other attributes are added by the
router. (Commit 7bd9da, lines 160-166). The Router source assigns it
in line 122. ('attrs["root"])' is "request.__dict__["root"]').

https://github.com/Pylons/pyramid/blob/master/src/pyramid/request.py
https://github.com/Pylons/pyramid/blob/master/src/pyramid/router.py

I'd think 'copy' would still find it but there may be another
complication in the request/router/interface machinery.  If you only
need the instance attributes, you could do 'myobject.__dict__ =
request.__dict__.copy()'. You might still get the same exception with
that.

On Tue, Jan 15, 2019 at 2:09 AM Thierry Florac <[email protected]> wrote:
>
> Hi,
> Simple question: I have a use case where I need to create an exact copy (a 
> clone) of a request, to update it's properties and make "simulations" 
> (actually by providing custom marker interfaces) without modifying the 
> original request.
> Is there a good way to do this?
> Actually I just tried to do a "request.copy()", but then I get errors like 
> "AttributeError: 'Request' object has no attribute 'root'" when trying to get 
> access to "root" attribute...
>
> Thanks for any help,
> Thierry
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWAWwAbA6MAWHP_2C-3PxfKiXktt1mecJHp5aokeZVOwdA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Mike Orr <[email protected]>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAH9f%3DurqqBtYVgBmcAb2m6tQQHk%3DSOZGwfe-GCs1yfY99frNwA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to