Opened 8 years ago

Closed 8 years ago

#16333 closed Uncategorized (wontfix)

RegexURLResolver can get urlpatters list defined by set_urlconf, but get_resolver returns TypeError

Reported by: anonymous Owned by: nobody
Component: Core (Other) Version: 1.3
Severity: Normal Keywords: urlresolvers
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Example from tests:

from django.core.urlresolvers import set_urlconf, reverse
from django.conf.urls.defaults import *

urlpatterns = patterns('',
    url(r'^router/$', router, name='router'),
    url(r'^router/api/$', router.api, name='api'),    

class TestRpc(TestCase):
    def setUp(self):
    def tearDown(self):
    def test_base(self):
        print reverse('router')

Problem is that *patterns* returns *list*, which can't be key of cache in *memoize* function, which wraps *get_resolver*. So simple:

urlpatterns = tuple(urlpatterns)

resolves this problem for my example.

Change History (1)

comment:1 Changed 8 years ago by Łukasz Rekucki

Resolution: wontfix
Status: newclosed

I may be missing something, but why not use the urls option (" if you want to swap that out in a test case.

Note: See TracTickets for help on using tickets.
Back to Top