Hmmm. That prevents an immediate crash, but may cause other problems. Here is a better fix: change lines 45,46 to:
if settings.APPEND_SLASH:
if (len(old_url[1]) > 0):
if (old_url[1][-1] != '/' and ('.' not in
old_url[1].split('/')[-1]):
new_url[1] = new_url[1] + '/'
else:
new_url[1] = '/'
That should do it...

