Defying Classification

by Malcolm Tredinnick

Topic: software/django

Thu 26 Mar 2009

Django Tip: Controlling Admin (Or Other) Access

Posted at 12:28 +1100

A very quick tip today, but one I think is under-appreciated by organisations rolling out a Django-based product.

Suppose you've created a useful web-based product, some portions of which are managed via Django's admin interface. All administration work is done from machines on an internal, trusted network and you don't want to expose the admin site via the external web server. This configuration is surprisingly simple to set up and maintain.

(Read more...)

Topics: software/django/tips

Mon 23 Mar 2009

Yak Shaving For Advanced Players

Posted at 12:13 +1100 (edited 14:08)

You know what yak shaving is about, right? Well, here's an example of how it made an appearance in some recent Django work. In order to finish something that looked relatively simple on the exterior, so many other steps had to take place that it seemed like I would never finish.


(Image by LiminalMike)

So, the (long, technical) story of deferred database field loading in Django and how five other problems were fixed along the way. It's a "week in the life of an open source developer" brain dump. If you're not interested in implementation details, best to move onto the next web page.

(Read more...)

Topics: software/django

Thu 12 Mar 2009

Um... Wow.

Posted at 14:11 +1100

Jacob receiving bacon for Django was almost the highlight of today.

Then I was processing mail and came across this little note and a link to a page about Django critter. Way better than the pony with magical powers. That's really special.

That's going to be the highlight of the week.

Topics: software/django

Tue 10 Mar 2009

Using Django's Aggregation Features

Posted at 11:22 +1100 (edited 14:40)

In the Django 1.1 release, one of the big new features will be something called "aggregation support". This is the end result of a Google Summer of Code project undertaken by Nicolas Lara (his djangopeople.net entry), supervised by Russell Keith-Magee, with contributions from a cast of thousands in final tweaks and testing. A lot of work over the previous couple of years in the ORM has been directed towards making stuff like this possible, so it's nice to now reap some of the rewards for that diligence.

When people start using aggregation, it should mostly be fairly straightforward, but a few problems that look like they should have solutions will require some thinking. At least initially. That's partly a matter of getting a handle on the syntax (it wasn't trivial to wrap up some of those database concepts into an API that looked natural in existing Python and Django code). It's also partly a matter of experience and thinking about things in a particular way. So I thought I'd get a head-start on some explanatory posts around this area.

(Read more...)

Topics: software/databases, software/django

Mon 9 Mar 2009

Bug Triaging: Boring, But Useful

Posted at 09:39 +1100

On the subject of thanking people and acknowledging slightly boring, but necessary, work (which I was, have you guys noticed what Jacob Kaplan-Moss did a couple of weeks ago?

Not the thing where he changed jobs (again!), but the hours he put into going over all the tickets in "unreviewed" status in Django's Trac. Have a look at this:

(Read more...)

Topics: software/django

Sun 8 Mar 2009

"No Patch" versus "Starting Patch"

Posted at 13:20 +1100 (edited 14:46)

"Especially for developers who are just starting out with submitting patches to a project, it's rare that a patch is of sufficiently high quality that it can be applied directly into the repository without needing fixups of one kind or another. The patch might not have the right coding style compared to the surrounding code, or it might be fundamentally buggy because the patch submitter didn't understand the code completely. Indeed, more often than not, when someone submits a patch to me, it is more useful for indicating the location of the bug more than anything else, and I often have to completely rewrite the patch before it enters into the e2fsprogs mainline repository. " — Ted Ts'o

Experienced Linux kernel hacker (and e2fs and other stuff maintainer and all-around nice guy), Ted Ts'o wrote a blog piece a couple of weeks ago about distributed version control systems. I've had that filed away on a "to blog about" list, as I'm trying to pull together some related threads on the topic. However, I missed one independent gem in the article: the quote at the head of this piece. Fortunately, Jonathan Corbet, over at LWN did not.

Ted's observation matches my experience in other projects as well. And I'd like to emphasise the "guiding light" aspect of any initial patch as a very positive thing.

(Read more...)

Topics: software/django, software/linux

Fri 6 Mar 2009

Testing In GeoDjango (part 2)

Posted at 13:15 +1100

A quick follow-up to my post about testing in GeoDjango. I've received a couple of pieces of feedback about some things I could also have mentioned and had forgotten.

(Read more...)

Topics: software/django/gis

Fri 6 Mar 2009

Thank People. It's Encouraging

Posted at 12:13 +1100

Permit me to channel your parents and all your former teachers for a moment...

When was the last time you said thank-you to somebody in the Open Source community for helping out with a problem or just writing some code you find useful on a daily basis? Too long ago, right? So make a note and, sometime over the next week or two, try to rectify that.

This does not mean everybody should send me thank-you email, either. Be at least a little bit original! Pick your own unsuspecting recipient.

We all (well, most of the people reading my blog, at least) use Open Source software on a daily basis. Even if you work in a fully funded Microsoft lab, I'll wager that a large portion of your information is served from Apache servers, or comes from RSS feeds generated by Open Source software (perhaps coming to you via an Open Source feed aggregator?). Sure, the price point is great and the code quality and support levels are generally excellent. But don't take it for granted.

My personal take on this: I do a lot of coding in Open Source land and spend at least a few hours each day helping out on mailing lists and in other forums. I do it because it's fun and improves my skills. Also because what I contribute in my little corner is reciprocated by other people in their particular areas of expertise and, between us all, a huge corpora of software arises, useful to everybody, including me and those other guys and girls. We all win.

Volunteerism isn't always beer and skittles. In fact there is a relative scarcity of either. It's sometimes a good thing that I don't have the ability to maim at a distance using only the power of my mind, let me say.

A genuine highlight of going through my morning pile of email is when somebody has taken 30 second or so to drop a note saying "thanks" for an answer to a question or a recent feature addition or bug fix. It doesn't have to be in email, either. Could be a blog post or a twitter message or anything. Always gives me a little boost to keep going and I can't be alone. A sporadic act of kindness never misses its mark.

So, randomly thank a nearby Open Source developer. Even if you're also one. It'll make their day a little bit brighter.

I've been meaning to write this post for a while (the last time I did so was a few years ago on Advogato). It was pushed to the front of my queue by some recent notes from Ben Collins-Sussman and Adrian Holovaty, who were commenting on the same thing in different ways.

Topics: software/django, software/linux, software/open source

Tue 3 Mar 2009

Testing In GeoDjango

Posted at 11:32 +1100 (edited 7 Mar 2009, 20:01)

The documentation for django.contrib.gis is generally excellent. Justin has done a great job of explaining how to set things up and filling out the "reference" portions, as well as a basic tutorial and lots of setting up instructions.

Writing documentation is a huge, and ongoing, task, however, and sometimes it isn't always complete with respect to the code it's documenting. So, here's a little filler for one of the missing pieces at the moment: how to integrate GeoDjango models with Django's test framework.

(If no obvious errors show up here in the near future, I'll write this up as a patch and send it upstream for inclusion in the main docs, although most of the docs already exist as docstrings if you know where to look. Think of this as a prototype explanation.)

(Read more...)

Topics: software/django/gis, software/django/tips

Tue 3 Feb 2009

Some Simple Django Debugging Tools

Posted at 15:01 +1100

Before you can debug a problem, sometimes before you even know a problem exists, you have to be able to work out what is going on. In many cases, this means somehow capturing the state of the system. Although most people encounter the odd Heisen-bug — a problem that seems to mysteriously vanish whenever you try to observe it — they aren't the common case.

There are a few little items that come with Django, right out of the box, which are not as well known as they might be. I don't always use these, but, at various times, they each play the role of right tool for the job. Nothing too deep here; I'm aiming only to put a few ideas into people's heads.

(Read more...)

Topics: software/django/tips