I’ve pulled the most common bits out of the Django views where I had rendered ODFs before and have the itty-bitty beginnings of an ODF handling/rendering library started now. “Library” is a bit of a stretch, since its only a few functions and a Bash script, but it abstracts the most mysterious/tedious parts of ODF handling already.
This is just a simple tarball right now. It unpacks like a Django app would, but only contains a copy of odfapper, funcs.py and a templatetags/odf_tags.py. But since we are doing template tag registration you need to include it in your INSTALLED_APPS in settings.py and add a new variable ODFAPPER_PATH which needs to be a string with the absolute path to /your/project/location/odfapper/odfapper. Importing into a views.py (or wherever) that you want to render ODFs in is done with from odfapper.funcs import render_odf, and I go into a bit more detail in the README included in the tarball. At the moment this post and the stuff in README (which is just an expansion of internal notes) is all the documentation.
I’ve got a ton more work I’d like to do on this. If there is any interest I could put a GitHub repo up — but other (paying) work calls to which this isn’t central, so… let me know if this is a direction anyone wants to head in and I’ll keep it going. There are a bajillion tiny things that are not so hard to do that would make ODF handling enormously more intuitive.
Link to 0.04 archive: odfapper_django-0.04.bz2
Link to just the shell update: odfapper-0.04.bz2
It bears mentioning that this is tested against Django 1.4, but not 1.5 yet. Unless the template loader classes have changed a lot then this should still work fine anyway, though.
3 thoughts on “ODFapper 0.04 for Django on Unix”
Its not on GitHub already because…?
1. It doesn’t do half what I wish it did — and I don’t have time to extend it properly just now.
2. General interest. Its only been downloaded a few hundred times since I posted it, and only three other developers have contacted me about using it in their sites.
3. Documentation about ODF as a format family would be ultimately more useful for template authors than focusing time on a GitHub project.
#3 is a cop-out.
#1 probably is too.
Pretty simple, but I see where you’re going. Any movement on this? In particular, any movement in the direction of pulling the pack/unpack into a Python script or maybe doing everything in via zipfile instead? Maybe there is some reason that isn’t a good idea? If users could somehow prepare their own docs and load them in a way that is convenient for the site developer this would really be awesome.
And seriously, GitHub? Or some place? Copouts. wtf