id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 6568,reverse URL resolution triggers import errors on views,Kenneth Arnold,nobody,"'''Short version''': urlresolvers {{{reverse()}}} should check named URLs before trying to import views. I've gotten bitten by this enough times to convince me it's a bug, and now looking at urlresolvers I'm convinced it's easily fixable. I use the {{{url}}} template tag and the {{{reverse}}} function all over the place for DRY sake. All of my URLs are named, so there's no reason to look in the views. Not too infrequently I'll make a typo in a view file, causing an import error. That shouldn't bother things when I go to somewhere else on the site that doesn't use that view file. And normally things go just fine... until a page hits a {{{url}}} tag or calls {{{reverse}}}. Then I get an !ImportError, because it tried to import the view with a syntax error. The debug page insists that the problem was in the url tag, though, and I have to dig around (usually drop to a shell and try importing each of my views) to find the real cause of the problem. A simple fix -- and slight optimization -- is to check for {{{lookup_view}}} in {{{reverse_dict}}} before trying to {{{get_callable}}}. I'll write up a patch on Monday if no one else gets to it first. ",,closed,Core (Other),dev,,wontfix,reverse url view import error,,Design decision needed,0,0,0,0,0,0