import antigravity

Posted by sciyoshi on December 30th, 2008

I was looking through Python 3.0's standard library today (/usr/lib/python30/) to see what had changed, and found this interesting tidbit: apparently, "import antigravity" now works, and opens up a web browser pointing to the classic XKCD comic. Doesn't seem like this has been backported to 2.6 yet :-). I guess that's another nice easter ...

Read full entry and comments

Fixing moved subversion repositories when using git-svn

Posted by sciyoshi on December 18th, 2008

This is mostly for my own later reference, and in case anybody finds this of use.

The instructions are based off ones I found here and here, and are simply modified for people who are using the noMetadata option for git-svn. This is useful for one-shot importing from svn to git.

Suppose that the files were moved in revision 100 ...

Read full entry and comments

Rails-like MVC Controllers for Django

Posted by sciyoshi on November 18th, 2008

One thing that sometimes annoys me about Django is how views inside an application are simply top-level functions inside the views.py module. This is fine for simple applications, but if you're trying to make anything more complicated this can become a burden. Suppose that a view needs some logic to decide whether or not the logged-in user can ...

Read full entry and comments

Using Akismet/TypePad AntiSpam with Django's new comments framework

Posted by sciyoshi on August 27th, 2008

I've just recently started getting lots of spam in my comments. I was originally using a custom OpenID-enabled commenting app that I had written, but decided to switch to the new Django commenting system since it looked interesting. The honeypot doesn't seem to be working though, because spam's still getting through...

Although django-comment-utils provides similar functionality, it ...

Read full entry and comments

Custom Django manager that excludes subclasses

Posted by sciyoshi on August 7th, 2008

When you're using Django model inheritance, sometimes you want to be able to get objects of the base class that aren't instances of any of the subclasses. You might expect the obvious way of doing this, SuperModel.objects.filter(submodel__isnull=True), to work, but unfortunately it doesn't. (Neither does SuperModel.objects.filter(submodel__supermodel_ptr=None), or any other ...

Read full entry and comments