Pyramid Framework - Can you call two seperate view functions to the same template

与世无争的帅哥 提交于 2019-12-08 06:34:06

问题


I was playing around with the pyramid framework, and I was wondering if it is possible to call two view functions to the same template:

so for example:

def view1(request)
    args1 = 'a string'
    return render_to_response('page.mak',{'args1'=args1}, request=request)

def view2(request)
    args2 = 'a string 2'
    return render_to_response('page.mak',{'args2'=args2}, request=request)

So, note both are using the page.mak template.


回答1:


{'args1'=args1}

is not valid Python.

{'args1':args1}

is though.




回答2:


Yes it is. Why do you suspect this would be a problem? Have you tried it and hit some error?



来源:https://stackoverflow.com/questions/5289680/pyramid-framework-can-you-call-two-seperate-view-functions-to-the-same-templat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!