So I have 2 views and I want to setting a new search_cache while invoking view1 from view2. Can we do it in Pyramid?
@view_config(route_name="view1", request_method=["POST"], renderer="json")
def view1(self, search_cache=123):
print('search_cache', search_cache)
@view_config(route_name="view2")
def view2(self):
subreq = self.request.copy()
subreq.path_info = "/view1"
subreq.method = "POST"
# Want to pass search_cache=456
subreq.body = json.dumps({}).encode()
response = self.request.invoke_subrequest(subreq)