tiddlyweb value proposition

6 views
Skip to first unread message

Chris Dent

unread,
Oct 28, 2009, 7:55:51 AM10/28/09
to tidd...@googlegroups.com

Yesterday I wrote a blog posting that may be of use for people
wondering what to do with TiddlyWeb or what the special sauce of
TiddlyWeb is.

http://cdent.tumblr.com/post/225212920/tiddlyweb-value-proposition

Paul Downey

unread,
Oct 28, 2009, 10:02:47 AM10/28/09
to tidd...@googlegroups.com

I'm still learning about TiddlyWeb, but I can share my initial reactions:

TiddlyWeb "items" are resources in their natural state. That's
powerful, RESTful and maps on to filesystem stores and schemaless
databases beautifully.

This compares to Django and Rails, where the data is stored in a DB,
and mapped to and from objects. I'd characterise Rails as caring
firstly about the database, which is automagically mapped to objects.
Django to me is object centric, mapping back to the database. But I
could be wrong in that mental model.

TiddlyWeb, OTOH, handles collections and assembly of items, using
TiddlyWiki concepts of Tiddler, Recipe and a concept new to TiddlyWebm
that of a partitioned collection or a Bag. The store surfaces some
common fields such as modifier, and modified date, but beyond that,
the metadata available is dependent upon the store, and the
representation of the tiddler being stored.

This means you can store *anything* in TiddlyWeb, but makes writing
serializers trickier than in Django or Rails where there is a point of
uniformity. As a result you have to handle many-to-many mapping in a
serializer, which can be tricky when writing formats with specific
field values such as RTF, geo-RSS, FOAF and XSPF, as opposed to
generic serializations which can write whatever fields they find using
the names in the representation, such as XML and JSON.

Another point I'd note is Django and Rails have uniform URIs which map
on to resources, but which may be configured through routes. This
appeals to fetishists like me who care about human readable URIs.

TiddlyWeb takes the view that the URI structure should be uniform
across all TiddlyWebs, so the names "bag" and "recipe" appear in the
URIs. Although it's possible to rewrite the URIs in some web servers,
this routing can be problematic with HTTP verbs such as PUT and isn't
something encouraged or supported by the TiddlyWeb framework.

Does that sound about right?

--
Paul (psd)
http://blog.whatfettle.com

Chris Dent

unread,
Oct 28, 2009, 10:42:39 AM10/28/09
to tidd...@googlegroups.com

On Oct 28, 2009, at 2:02 PM, Paul Downey wrote:

[snip]

A tentative "yes" to all of the above, but I'll need to think about it
a bit more deeply. I think the key point to what you've said is
"assembly". TiddlyWeb is all about composition of "stuff".

> Another point I'd note is Django and Rails have uniform URIs which map
> on to resources, but which may be configured through routes. This
> appeals to fetishists like me who care about human readable URIs.

This is possible in a pretty straightforward way with TiddlyWeb, but
is not surfaced because it conflicts with one of the original goals of
TiddlyWeb, which was to create a uniform REST API for server-side
storage of Tiddlers. If different TiddlyWeb installations are using
different routes to bags, recipes and tiddlers, then client code
created for those installations is not usable with other installations.

But say you wanted to have, at the root level, access to a bag full of
tiddlers that represents people of some kind. Because of previous
commitments in the maps you'd have a few reserved words (e.g. bags and
recipes) but other than that you could have /psd utilize the data in
the tiddler 'psd' in bag 'people' with code like this:

-=-=-
from tiddlyweb.web.handler.tiddler import get as get_tiddler
PEOPLE_BAG = 'people'

def init(config):
config['selector'].add('/{person}', GET=get_person)

def get_person(environ, start_response):
environ['wsgiorg.routing_args'][1]['tiddler_name'] = \
environ['wsgiorg.routing_args'][1]['person']
environ['wsgiorg.routing_args'][1]['bag_name'] = PEOPLE_BAG
return get_tiddler(environ, start_response)
-=-=-

(That's untested)

The basic principle here is that we're establishing the data needed to
then call the handler for an existing route. So we still get all the
error handling, content-negotiation handling, permissions stuff and
serialization handling used in the "normal" route.

That code could be abstracted to a utility function that would allow
something like (psuedocode):

def init(config):
map_to_tiddler(config, '/{person}', bag='foo')

in a plugin (the _entire_ plugin). Where map_to_tiddler would take
either a bag or recipe arg, depending on where you wanted the mapping
to go.

(It's also possible to change the urls.map directly.)

> TiddlyWeb takes the view that the URI structure should be uniform
> across all TiddlyWebs, so the names "bag" and "recipe" appear in the
> URIs. Although it's possible to rewrite the URIs in some web servers,
> this routing can be problematic with HTTP verbs such as PUT and isn't
> something encouraged or supported by the TiddlyWeb framework.

I'd state that a bit differently to include some of the stuff from
above: TiddlyWeb takes the view that there should be a part of the URI
structure that is uniform across all TiddlyWeb. If additional URIs are
desired, then there are options both in TiddlyWeb code and web server
configuration to add those URIs. Special installations may even opt to
disable some of the core URIs[1].

> Does that sound about right?


Yeah, thanks. I hope we can dig deeper into the notion of collections
and composition.

[1] This is done in the new Avox wiki-data system. Listing all the
tiddlers in the one bag is disabled because it's just too much data.

chris...@gmail.com

unread,
Oct 28, 2009, 11:32:15 AM10/28/09
to TiddlyWeb


On Oct 28, 2:42 pm, Chris Dent <chris.d...@gmail.com> wrote:
> That code could be abstracted to a utility function that would allow  
> something like (psuedocode):
>
>   def init(config):
>      map_to_tiddler(config, '/{person}', bag='foo')
>
> in a plugin (the _entire_ plugin). Where map_to_tiddler would take  
> either a bag or recipe arg, depending on where you wanted the mapping  
> to go.

This seemed like such a good idea I added it to the
tiddlywebplugins.utils package:

http://github.com/tiddlyweb/tiddlywebplugins/commit/90801d1c117d0ce0119e5b4ca1e4ac8509bd5699

I've not yet released the new version of the package yet.

chris...@gmail.com

unread,
Oct 28, 2009, 12:28:33 PM10/28/09
to TiddlyWeb


On Oct 28, 3:32 pm, "cd...@peermore.com" <chris.d...@gmail.com> wrote:
> I've not yet released the new version of the package yet.

Now I have:

http://pypi.python.org/pypi/tiddlywebplugins.utils
Reply all
Reply to author
Forward
0 new messages