Print

Print


Hi Godmar:

Perhaps this will seem backwards, but rather than trying to adapt (or
create) a generic AtomPub implementation I've been using vanilla
django, and just rolling my own atom feed and service documents as
standard templates. The advantage here is that my code is custom
suited to my task at hand: namely a SWORD implementation to allow
known parties to upload BagIt content packages to a "repository".

Django's support for RESTful practices [1,2] make it relatively easy
to do the RESTy things that atompub requires. I imagine the same can
be said of other web frameworks RubyOnRails, PHP, Catalyst, etc. I
wonder what Ross' mileage has been with his Jangle [3]
implementations?

The one caveat to this was handling large POSTs of data, if your
atompub service needs to handle these. Django has good support for
streaming form file uploads (multipart/form-data). But other POSTed
media is made available via HttpRequest.raw_post_data, which slurps
the whole message body into memory--which is problematic for large
POSTs.

The nice thing about AtomPub (RFC5023) [4] is that it's a super-clean
spec, written by some of the luminaries of the web world. So if you
are interested in how the web works as an architecture it's a lot of
fun. It's also a nice gateway into the IETF family of standards.

The one thing I didn't roll myself was code for handling
authentication with HTTP BasicAuth. At the time (perhaps still) HTTP
BasicAuth wasn't part of core django. But I found a nice snippet that
provided a view-by-view decorator for controlling this [5].

//Ed

[1] http://www.pointy-stick.com/blog/2008/12/09/implementing-http-services-django/
[2] http://www.pointy-stick.com/blog/2008/12/13/etags-and-modification-times-django/
[3] http://www.jangle.org/
[4] http://bitworking.org/projects/atom/rfc5023.html
[5] http://www.djangosnippets.org/snippets/243/