Sunday, February 25, 2007

django stuff

(Mind you I'm just starting with django, so correct me if I'm wrong. Heck, if I'm wrong, correct me anyways :)

I was working on an app of mine on a new machine, and installed django-0.95.1. Pulling my code of subversion, I ran into a problem. In urls.py, I would do something like this:
from myapp.views import some_func

Within urlpatterns I'd have something like this:
urlpatterns = patterns('',
   (r'^$', some_func)
)


Which worked fine, until today. Now I'd get:
'function' object has no attribute 'rindex'

I finally figured out the problem was in the way I was calling some_func.

The way I fixed it was removing the line that imported some_func, and reworking the urlpatterns entry to read:
urlpatterns = patterns('',
   (r'^$', 'myapp.views.some_func')
)