Edit CouchDB Attachments Directly with CouchDB-FUSE

Posted in couchdb, couchdb-fuse, fuse, python at 10:50 p.m. on the 25th of November, 2008.

After some hacking about with the rather badly documented Python FUSE bindings, I have finally managed to mount a CouchDB document's attachments directly onto a virtual filesystem!

Screen Shot of an attachment.

Use Cases

  • If you've read My Couch or Yours? Shareable Apps Are The Future by jchris, this is a great time-saver if you want to edit HTML, JavaScript, CSS or even image files directly using your favourite editor.
  • Uploading large numbers of files repetitively through Futon or even via a Python prompt becomes tedious very quickly: drag'n'drop or cp * is the way forward!

Installation

You need the following:

  1. Python FUSE bindings
  2. CouchDB-Python 0.5 or greater
  3. CouchDB-FUSE

Running python setup.py install should install a couchmount script on your path.

Usage

$ mkdir mnt
$ couchmount http://localhost:5984/jasondavies/_design%2Flinks mnt/
$ ls mnt/
$ touch mnt/foo
$ ls mnt/
foo
$ 

...you get the idea...

Happy Couching!

0 comments

Django 1.0!

Posted in django, python, programming at 9:06 a.m. on the 04th of September, 2008.

Finally, Django 1.0 is released!

After countless hours of hard work by many talented people, it is a pleasure to see the long-awaited version 1.0 released to the world. Finally, a version number that reflects the quality of the codebase, which in fact I have been using in production for many months.

New features that I am excited about include:

Re-factored admin application

Developed under the newforms-admin branch for a long while, the re-factored admin application is much more customisable and means I don't have to do so many ugly hacks and workarounds any more. See the admin reference for details.

Re-factored ORM

The internals of the ORM were pretty much rewritten from scratch in the queryset-refactor branch, resulting in many annoying bugs being fixed. This also includes support for model inheritance, which allows for more elegant models. See the wiki for more details.

Have fun!

0 comments

pythontracer

Posted in python, profiling at 12:20 a.m. on the 09th of March, 2008.

Lets you see your Python program's execution as a tree of function invocations, each tree node exposing the real time, and CPU time (user/sys) of that call.

This looks pretty cool, I will have to try this out on some of my Django projects.

0 comments

Generator Expressions in Python

Posted in python at 11:41 p.m. on the 10th of February, 2008.

I have long been a fan of list comprehensions in Python, but it's only recently that I discovered a related piece of sugary syntax: generator expressions.

Now, instead of something like:

sum([item.price for item in self.item_set.all()])

I do:

sum(item.price for item in self.item_set.all())

Just that little bit cleaner and more efficient...

0 comments

Style: Normal Dark