Will >> Will's blog

purpose: Will Kahn-Greene's blog of Miro, PyBlosxom, Python, GNU/Linux, random content, PyBlosxom, Miro, and other projects mixed in there ad hoc, half-baked, and with a twist of lemon

Thu, 29 Apr 2010

Building templates for Quickly and new webber-app template

Quickly is an application that makes it easier to start new software development projects by filling in a lot of the skeletal structure from a set of templates. I've read about it a bunch on Jono's blog in the context of his push for "opportunistic developers".

Chris Webber and I have been throwing together web applications most of which have the same basic structure: WebOb, Jinja2, simplejson, and routes with some glue and stuff in between.

I spent some time building a Quickly template for this structure. The results of this are at http://gitorious.org/quickly-webber-app.

It was kind of a pain in the ass. There's no docmentation that I could find on creating templates for Quickly, so I had to look through the ubuntu-project template and read through the Quickly code. Even then, I bumped into a few gotchas.

  1. the command scripts are run as scripts and not imported as Python modules
  2. commands cripts must be executable, otherwise Quickly silently skips them when building its commands list
  3. probably better to develop the template in your ~/quickly-templates/ directory rather than as a project and schlepping things in and out like I did

I was using the Quickly that comes with Ubuntu Karmic which is 0.2.6. Ubuntu Lucid has a newer version, but I didn't want to fiddle with trying to get it to install on Karmic given that it's got dependencies that aren't readily available in Karmic.

After talking with Chris, he suggested I redo it with Paste templates. There's a good explanation at http://pylonshq.com/docs/en/0.9.7/advanced_pylons/creating_paste_templates/. It'd be interesting to see if I could build a set of templates that works with both Quickly and Paste.

Anyhow, the project is there if it's interesting to anyone. Email me or comment below if you have questions, comments, concerns, whatever.

Update 5/2/2010 - Didier (Quickly dev) says there is documentation for creating templates at http://www.didrocks.fr/index.php/post/Build-your-application-quickly-with-Quickly%3A-Inside-Quickly-part-6.

Fri, 14 Aug 2009

Theora Cookbook

The folks at FLOSS Manuals put together a Theora Cookbook. It's a great book that covers Theora and publishing video on the Internet.

It's definitely worth reading/skimming if you're interested in Open Video, Theora, and the impending future of video on the Internet.

Fri, 14 Apr 2006

Wedding site: using Pylons

I'm building a wedding site that contains mostly static material but has some material that's reminsicent of CMS and some material that's database-driven, too.

I surveyed the scene of Python web-frameworks and settled on Pylons for various reasons but mostly because:

I've spent 40 minutes or so fiddling with the site so far with only a few minor issues which required me to go poking through documentation. One of the issues is that I have a series of templates in my templates/ dir and I uncommented out the commented out code in the template.py controller so it's like this:

from weddingwww.lib.base import *

class TemplateController(BaseController):
    def view(self, url):
        from pkg_resources import resource_exists
        if resource_exists('weddingwww', url+'.myt'):
            m.subexec(url+'.myt')
        else:
            m.abort(404, "File not found '%s'" % url)

That doesn't seem to work as I'd expect. For example, if I go to http://localhost:5000/meeting, the url parameter ends up as meeting but the resources_exist returns a false even though there's a meeting.myt file in my templates directory.

After fiddling with this and trying to figure out where pkg_resources is defined, I just commented the code out and changed it to this:

from weddingwww.lib.base import *

class TemplateController(BaseController):
    def view(self, url):
        m.subexec(url+'.myt')

which obviously does the wrong thing if the file doesn't exist.

Thu, 05 Aug 2004

form input text centering

Had to look this up for a friend. The "text-align" css property allows you to align the value inside a form input text box.

  <input type=text style="text-align:center" name="blah" value="blah">

meta-refresh for html

I keep forgetting this and forgetting where I wrote it down. Irritating.

   <meta http-equiv="refresh" content="0; URL=http://bluesock.org/~willkg/blog/">