2011-08-11 32 views

回答

4

我不確定要理解您的問題,但在金字塔中重定向的常用方法是在視圖函數中返回一個HTTPFound實例。我認爲你也可以提高它,因爲這是一個例外。

from pyramid.httpexceptions import HTTPFound 

def my_view(request): 
    return HTTPFound('/new/location/to/redirect') 

一個好的做法是使用route_url建設要重定向到URL。

相關問題