Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cookbook/index.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ title: Web.py Cookbook 简体中文版
##Utils 实用工具:
* [如何发送邮件](sendmail.zh-cn)
* [如何利用Gmail发送邮件](sendmail_using_gmail.zh-cn)
* [使用soaplib实现webservice](/webservice.zh-cn)
* [使用soaplib实现webservice](webservice.zh-cn)

##Templates 模板
* [Templetor: web.py 模板系统](http://webpy.org/docs/0.3/templetor.zh-cn)
Expand Down
2 changes: 1 addition & 1 deletion cookbook/query.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ webpy不会尝试为您和您的数据库建立层。相反,它试图以方便
results = db.query("SELECT * FROM entries JOIN users WHERE entries.author_id = users.id")


为了防止SQL注入攻击,db.query还接受了“vars”语法如下描述[db.select](/cookbook/select):
为了防止SQL注入攻击,db.query还接受了“vars”语法如下描述[db.select](select.zh-cn):

results = db.query("SELECT * FROM users WHERE id=$id", vars={'id':10})

Expand Down
4 changes: 2 additions & 2 deletions cookbook/runtime-language-switch.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ title: 实时语言切换

## 解法:

* 首先你必须阅读 [模板语言中的i18n支持](/cookbook/i18n_support_in_template_file), 然后尝试下面的代码。
* 首先你必须阅读 [模板语言中的i18n支持](i18n_support_in_template_file.zh-cn), 然后尝试下面的代码。

文件: code.py

Expand Down Expand Up @@ -104,7 +104,7 @@ title: 实时语言切换

$_('Hello')

不要忘记生成必要的po&mo语言文件。参考: [模板语言中的i18n支持](/i18n_support_in_template_file)
不要忘记生成必要的po&mo语言文件。参考: [模板语言中的i18n支持](i18n_support_in_template_file.zh-cn)

现在运行code.py:

Expand Down
2 changes: 1 addition & 1 deletion cookbook/template_import.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ Naturally, you will want to write a module, say _displayLogic.py_ and import tha
... ...
<div>Status: $stat(status)</div>

Remember that you can import more than one name into the _globals_ dict. This trick is also used in [importing session variable into template](/cookbook/session_in_template).
Remember that you can import more than one name into the _globals_ dict. This trick is also used in [importing session variable into template](session_in_template.zh-cn).
6 changes: 3 additions & 3 deletions cookbook/url_handling.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ web.py的URL控制模式是简单的、强大的、灵活的。在每个应用

http://localhost/myapp/greetings/hello?name=Joe

这个URL的路径是 _/myapp/greetings/hello_。web.py会在内部给URL路径加上^和$ ,这样 _/tasks/_ 不会匹配 _/tasks/addnew_。URL匹配依赖于“路径”,所以不能这样使用,如: _/tasks/delete?name=(.+)_ ,?之后部分表示是“查询”,并不会被匹配。阅读URL组件的更多细节,请访问[web.ctx](/cookbook/ctx/zh-cn)。
这个URL的路径是 _/myapp/greetings/hello_。web.py会在内部给URL路径加上^和$ ,这样 _/tasks/_ 不会匹配 _/tasks/addnew_。URL匹配依赖于“路径”,所以不能这样使用,如: _/tasks/delete?name=(.+)_ ,?之后部分表示是“查询”,并不会被匹配。阅读URL组件的更多细节,请访问[web.ctx](ctx.zh-cn)。

`捕捉参数`

Expand All @@ -43,8 +43,8 @@ web.py的URL控制模式是简单的、强大的、灵活的。在每个应用
def GET(self, name):
return "Listing info about user: {0}".format(name)

你可以根据需要定义更多参数。同时要注意URL查询的参数(?后面的内容)也可以用[web.input()](/cookbook/input/zh-cn)取得。
你可以根据需要定义更多参数。同时要注意URL查询的参数(?后面的内容)也可以用[web.input()](input.zh-cn)取得。

`开发子程序的时候注意`

为了更好的控制大型web应用,web.py支持[子程序](/cookbook/subapp/zh-cn)。在为子程序设计URL模式的时候,记住取到的路径(web.ctx.path)是父应用剥离后的。比如,你在主程序定义了URL"/blog"跳转到'blog'子程序,那没在你blog子程序中所有URL都是以"/"开头的,而不是"/blog"。查看[web.ctx](/cookbook/ctx/zh-cn)取得更多信息。
为了更好的控制大型web应用,web.py支持[子程序](subapp.zh-cn)。在为子程序设计URL模式的时候,记住取到的路径(web.ctx.path)是父应用剥离后的。比如,你在主程序定义了URL"/blog"跳转到'blog'子程序,那没在你blog子程序中所有URL都是以"/"开头的,而不是"/blog"。查看[web.ctx](ctx.zh-cn)取得更多信息。