向tiddlyweb添加post和二进制文件上载(通过html)支持

tiddlywebplugins.form的Python项目详细描述


tiddlywebplugins.form

提供序列化程序以将HTML表单数据转换为可放入存储区的对象。

还添加了对标准url集的post支持和对上载二进制文件的支持。

支持post的url是:

/bags/foo/tiddlers /recipes/foo/tiddlers

要使用,请将tiddlywebplugins.form添加到tiddlywebconfig.py中的系统插件中。

然后,您可以按如下方式将整理程序发送到服务器:

  1. 使用任何命名元素设置HTML表单。支持的名称包括:

    title - tiddler.title (this is optional and, depends upon which URL you POST to. Additionally, if you POST to /bags/foo/tiddlers without a title, you will get a UUID title instead). text - tiddler.text tags - tiddler.tags (this can be a list (eg checkboxes), or a string formatted as per standard TiddlyWiki tags). created - tiddler.created modified - tiddler.modified file - this is a special case and represents a binary file so must take the form of an HTML <input type=”file” /> tag. If this is specified, you may include tags and a title, but anything else will be ignored.

  2. 表单的内容类型(HTML表单行话中的enctype属性)必须是appilation/x-www-form-urlencoded或multipart/form数据(如果上载二进制文件)

  3. 将表单(ie-set the method to post)发布到上述URL之一(ie-set the action attribute),根据需要替换foo。

  4. (可选)指定重定向以重定向到其他页面。

示例用法:

如果您想将一个新的tiddler发布到包“common”,您可以包含以下html:

<;form action=“/bags/common/tiddler”method=“post”>; <;input type=“text”name=“title”value=“new tiddler”/>; <;textarea name=“text”rows=“5”cols=“40”>;<;/textarea>; <;input type=“text”name=“tags”/>; <;input type=“submit”value=“save”/>; <;/表单>;

或者,您可能希望将二进制文件上载到包“common”:

<;form action=“/bags/common/tiddler”method=“post”enctype=“multipart/form data”>; <;input type=“file”name=“file”/>; <;input type=“submit”value=“upload”/>; <;/表单>;

还有一个为tiddlywiki设计的二进制上传插件,专门用于tiddlyweplugins.form。你可以在https://raw.githubusercontent.com/TiddlySpace/tiddlyspace/master/src/plugins/BinaryUploadPlugin.js

您可以在https://github.com/tiddlyweb/tiddlywebplugins.form

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何在Android Wifi中筛选相同的SSID?   Java中重写接口中异常处理的泛型   java“无效转义序列(有效的是\b\t\n\f\r\”\“\”\)”语法错误   使用JNDI的java NameReadyBoundException   java如何在这个程序上执行算法   java为什么我的应用程序在调试时崩溃而应用程序停止?   Java:while循环未检测到中断条件,但如果块检测到   java如何快速使用jfreechart创建的折线图   java将输入放入JSTL会话变量,以便稍后在屏幕上显示   java在spring boot中加载外部JAR   java Apache NiFi无法使用ojdbc6连接到Oracle 12c。jar或ojdbc8。罐子   java解释StringToWordVector()Weka的输出   java charAt()找不到符号   使用mpjexpress的java阅读控制台输入