阅 读 文 章

snakelets 文档,我翻译了一部分。

[来源:网上转载 (http://www.chinaunix.net) | 作者:网友(瘦青蛙) | 时间:2007-05-27 | 浏览:人次 ]


在其他web server中,正确处理非ASCII字符或者符号是非常痛苦的。在Snakelet中不需要这样。您只需要要求您页面的输出编码(比如 UTF-8),随意的设置输入编码(如果您的源文件使用特殊字符编码编写),Snakelet将会很好的照顾这些编码。不要自己进行编码,只需要在页面中写入unicode字符串!如果您正在考虑FORM的输入表单,输入特殊字符页是没有问题的。Snakelet会处理所有这些字符,您只需要提供python 字符串(或者 Unicode 对象)。

[size=18]Content-type[/size]

Usually the default content type text/html is fine. But for special snakelets or Ypages you are not returning HTML, but a different file type (when you have created an image downloading snakelet, for instance). You have to specify the correct content type yourself in these cases.
一般默认内容类型是 text/html。但是对于特殊的snakelet或Ypage除了不同的文件类型以外您不能返回HTML(比如您创建了一个图片下载snakelet页面)。您需要自己指定正确的内容类型。

....write how to do this... defaultContentType....
。。。如何实现。。。defaultContentType...

FORM handling
...not yet written...
...还没有写...
Snakelets manual - Back to index


 瘦青蛙 回复于:2005-06-23 09:12:46

[size=18]Snakelet class[/size]

Your own snakelets have to subclass from the generic Snakelet class and thus inherit all methods from that class. You can use the following methods of the Snakelet base class:
您自己的snakelet类是从一般的Snakelet类中继承来的,因此也继承了这个类的所有方法。您可以使用这些基本的方法:
[list]
Method方法   Description描述
serve(request, response):
must override this to handle requests, the parameters are the request and response objects.
必须重载这个方法来处理请求,参数是 request 和 response对象

getWebApp()
the current WebApp object. Contains additional interesting methods.
当前的WebApp对象,包含附加的有趣的方法(???)。

getContext()
snakelet context (ContextContainer object). Scope: snakelet. shared for all users/requestssnakelet关系(环境?)(ContextContainer对象)。
范围:snakelet。对所有的用户/请求 共享。

getAppContext()
webapp context (ContextContainer object). Scope: web app. shared for all users/requestswebapp 前后关系 (ContextContainer对象).
范围:web app。对所有用户/请求 共享。

getPlugin(pluginname)
论坛热门帖子: [lch203] 写得蛮好的linux学习笔记(10-21)
[黑马制造] 学习java的30个目标(10-19)
[笑傲股林] 做测试半年了,有点迷茫,应该再学些什么提高自己的测试水平和测试能力呢?(10-19)
[udp8589] 大家用google的来吱一声? 用百度的~~也来报道下?(10-18)
[沂偌掳兆] 本人总结的一些认为C++比较经典的书籍,希望对大家有用(10-18)
TAG标签: 翻译 文档 使用 可以 页面 URL 如果 文件 webapp 一个

最新评论 共有1位网友发表了评论

发表评论

评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名:(注册)
密码:
验证码:
匿名发表

网站地图友情连接交流论坛网站投稿广告服务联系我们留言本站长统计
Some rights reserved: www.chmhome.com, 鄂ICP备07010232号 E-mail:chinakafei@live.com,QQ:552766
中国咖啡技术网(Chmhome):国外编程技术书籍,中文编程手册,经典编程文章,交流技术,技术软件下载,计算机论文,毕业论文.