Updated request copy to keep initial root and registry attributes
authorThierry Florac <tflorac@ulthar.net>
Wed, 16 Jan 2019 10:39:36 +0100
changeset 315 cf80c22164f9
parent 314 85c04f5d3df2
child 316 0cb1711cdd41
Updated request copy to keep initial root and registry attributes
src/pyams_utils/request.py
--- a/src/pyams_utils/request.py	Fri Jan 11 13:16:08 2019 +0100
+++ b/src/pyams_utils/request.py	Wed Jan 16 10:39:36 2019 +0100
@@ -189,13 +189,15 @@
 
 
 def copy_request(request):
-    """Create clone of given request, keeping registry as well"""
+    """Create clone of given request, keeping registry and root as well"""
+    root = request.root
     request = request.copy()
     if not hasattr(request, 'registry'):
         registry = get_current_registry()
         if registry is None:
             registry = get_global_registry()
         request.registry = registry
+    request.root = root
     return request