Pyramid Framework - Can you call two seperate view

2019-05-30 04:19发布

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.

2条回答
可以哭但决不认输i
2楼-- · 2019-05-30 04:20

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

查看更多
男人必须洒脱
3楼-- · 2019-05-30 04:37

{'args1'=args1}

is not valid Python.

{'args1':args1}

is though.

查看更多
登录 后发表回答