Django Views As Classes with Python’s __call__ Magic Method
I have been using Django off-and-on for about 2 years now. I am really liking the direction, but what bugged me (for the longest time) is the re-usability of the view section.
For those unfamiliar with Django views, they are not strictly “MVC” views. If anything, they act more like controllers, and I treat them as such. It should be a piece of cake to reuse code between these, but usually what happened was that I would define a bunch of private view functions and have them referenced by various view functions. It wasn’t exactly the shining pinnacle of my development career.
While reading the code for django-jqchat while working on a project for my client, I rediscovered the python __call__ magic method. This basically permits you to call an instance of an object like a function. With a little effort, I managed to re-organize the code to make it a little more easy to parse. This is not complete and not debugged, but maybe you will find it useful.
Interesting Comment on Islamic Banking
I previously considered Islamic banking a fraud, more or less at the same level as “halal pork”. This comment has forced me to reconsider.
Django Deployment Guide
Found this while watching a class on Safaribooksonline.
Get rid of unnecessary /chrootjail/lib files
I am not sure if I should actually publish this because it seems like hitting a fly with a nuke.