Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update application_processors.zh-cn.md
  • Loading branch information
leiqin committed Dec 12, 2012
1 parent 5be6b5c commit 8fe8f6e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion cookbook/application_processors.zh-cn.md
Expand Up @@ -30,4 +30,17 @@ web.py可以在处理请求之前或之后,通过添加处理器(processor)来
print "my unload hook"

app.add_processor(web.loadhook(my_loadhook))
app.add_processor(web.unloadhook(my_unloadhook))
app.add_processor(web.unloadhook(my_unloadhook))

你可以在钩子中使用和修改全局变量,比如:web.header()

def my_loadhook():
web.header('Content-type', "text/html; charset=utf-8")

app.add_processor(web.loadhook(my_loadhook))

###提示: 你也可以在钩子中使用 web.ctx 和 web.input() 。

def my_loadhook():
input = web.input()
print input

0 comments on commit 8fe8f6e

Please sign in to comment.