The following works for me whenever celery needs a dup request:
import plaster
from pyramid.request import Request, apply_request_extensions
def make_request():
loader = plaster.get_loader('development.ini', protocols=['wsgi'])
app = loader.get_wsgi_app()
r = Request.blank('/localhost:6543')
r.registry = app.registry
apply_request_extensions(r)
return r
On Tuesday, January 15, 2019 at 5:09:18 AM UTC-5, Thierry Florac 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/feac8d1c-4f07-46a6-af06-dc94eb1b2d69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.