Skip to main content

Adds POST and binary file upload (via HTML) support to TiddlyWeb

Project description

tiddlywebplugins.form

Provides a Serializer to transform HTML form-data into an object that can be put into the store.

Also adds POST support to the standard set of URLs and support for uploading binary files.

URLs with POST support are:

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

To use, add tiddlywebplugins.form to your system_plugins in tiddlywebconfig.py.

You can then POST tiddlers to the server as follows:

  1. set up an HTML form with any named elements. Supported names include:

    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. Content type (enctype attribute in HTML form lingo) of the form must be either appilcation/x-www-form-urlencoded or multipart/form-data (if uploading a binary file)

  3. POST the form (ie - set the method to POST) to one of the above URLs (ie - set the action attribute), replacing foo as required.

  4. Optionally specificy a redirect to redirect to a different page.

Example Usage:

say you want to POST a new tiddler to the bag “common”, you might include the following HTML:

<form action=”/bags/common/tiddlers” 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” /> </form>

Alternatively, you may want to upload a binary file to the bag “common”:

<form action=”/bags/common/tiddlers” method=”POST” enctype=”multipart/form-data”> <input type=”file” name=”file” /> <input type=”submit” value=”Upload” /> </form>

There is also a Binary Upload Plugin for TiddlyWiki designed specifically to work with tiddlyweplugins.form. You can find it at http://svn.tiddlywiki.org/Trunk/contributors/BenGillies/TiddlyWeb/Plugins/Binary/tiddlers/BinaryUploadPlugin.tid

You can find the source code at https://github.com/bengillies/tiddlywebplugins.form

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tiddlywebplugins.form-0.7.tar.gz (12.8 kB view details)

Uploaded Source

File details

Details for the file tiddlywebplugins.form-0.7.tar.gz.

File metadata

File hashes

Hashes for tiddlywebplugins.form-0.7.tar.gz
Algorithm Hash digest
SHA256 cd3a1d7a52b68e7875f1c57d41372afecc4fe372ed8fff11457b87f1e7ca4df6
MD5 5b962fdcaebb5bcf6242e20a1d889ac3
BLAKE2b-256 836f3593e22e208b49aded70e7b7efdaa4135c4aff0521deb7ea9080711eee5a

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page