在其他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)
上一页 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2324 25 26 27 28 29 30 31 32 33 34 35 36 37 38 下一页
| 论坛热门帖子: | [lch203] 写得蛮好的linux学习笔记(10-21) [黑马制造] 学习java的30个目标(10-19) [笑傲股林] 做测试半年了,有点迷茫,应该再学些什么提高自己的测试水平和测试能力呢?(10-19) [udp8589] 大家用google的来吱一声? 用百度的~~也来报道下?(10-18) [沂偌掳兆] 本人总结的一些认为C++比较经典的书籍,希望对大家有用(10-18) |
| TAG标签: | 翻译 文档 使用 可以 页面 URL 如果 文件 webapp 一个 |
注册
个人空间
