E-Scribe : a programmer’s blog

About Me

PBX I'm Paul Bissex. I build web applications using open source software, especially Django. Started my career doing graphic design for newspapers and magazines in the '90s. Then wrote tech commentary and reviews for Wired, Salon, Chicago Tribune, and others you never heard of. Then I built operations software at a photography school. Then I helped big media serve 40 million pages a day. Then I worked on a translation services API doing millions of dollars of business. Now I'm building the core platform of a global startup accelerator. Feel free to email me.

Book

I co-wrote "Python Web Development with Django". It was the first book to cover the long-awaited Django 1.0. Published by Addison-Wesley and still in print!

Colophon

Built using Django, served with gunicorn and nginx. The database is SQLite. Hosted on a FreeBSD VPS at Johncompanies.com. Comment-spam protection by Akismet.

Pile o'Tags

Stuff I Use

bitbucket, Django, Emacs, FreeBSD, Git, jQuery, LaunchBar, Markdown, Mercurial, OS X, Python, Review Board, S3, SQLite, Sublime Text, Ubuntu Linux

Spam Report

At least 236509 pieces of comment spam killed since 2008, mostly via Akismet.

Django: less (magic) is more

Today I updated my Django play/development environment to the new magic-removal branch, and migrated my proto-wiki as an exercise. Following the RemovingTheMagic instructions on the official Django wiki made it fairly easy. (I added some notes on dealing with custom template tags.)

This branch is about more than cleaning up some of the needlessly clever bits found in earlier implementations; it also has some really nice syntax refinements. Compare this:

reporters.get_list(fname__exact='John', order_by=('lname',))

to this:

Reporter.objects.filter(fname='John').order_by('lname')

No contest. I'm loving these refinements so much I almost don't want to get to 1.0!

Update: I did a count of the actual lines of Python in my little wiki project, not including settings.py and urls.py. Fifty-two -- and that's with the addition of a "delete" function, which I didn't have before.
The updated proto-wiki source is now available.

Sunday, February 12th, 2006
+
6 comments

Comment from Luke , later that day

The new syntax is rather nice. Have you discovered things like this:

(Reporter.objects.filter(fname='John') | Reporter.objects.filter(fname='Fred'))

? It does what you expect, and does it lazily (a single DB query). Sweet.

Comment from Andrew , later that day

As someone who is going to take another look at django because of this removing the magic, have you released the updated source to proto-wiki?

Comment from Paul , later that day

Andrew: I have now!

Luke: I hadn't seen that, thanks. A little verbose, but I definitely prefer it to the old double-underscore-delimited magic. Clearly I have some reading to catch up on.

Comment from Eric Moritz , 2 weeks later

This stuff is nice... I'm not looking forward to rewriting all my code though...

Comment from Tim , 10 months later

Thanks for sharing the code, I live the simplicity of Django/Python driven websites!

Comment from keith , 3 years later

i have downloaded you code but i keep getting an error about the WIKI_SITEBASE what is this and where do i get it?

Comments are closed for this post. But I welcome questions/comments via email or Twitter.