All this URL splitting code can go into a function. Speaking of which, there already is a function that does all this called `resolve()` (https://docs.djangoproject.com/en/1.4/topics/http/urls/#resolve). It takes a URL and using the list of urls in urls.py, gives you the view name and the proper list of arguments. Please use that. This code will break any time we want to change the urls for any reason.