Monday, October 23, 2006

Yet Another Use For (Python) Decorators
Python 2.4 came with this neat feature called decorators. For the longest time I didn't know what to do with this new feature, but I've since found a library of decorators.

Today I found another clever decorator trick: check to see if a user is logged into your web based system. The idea is to redirect the user to a login page if they haven't logged in yet, and send back whatever page if they are logged in.

Decorators are certainly one of those things that are only useful sometimes, and in particular patterns. Still, they are a powerful addition to the language...