#2713: Sitemap Index with Cache gives a NoReverseMatch exception
---------------------------------------------+------------------------------
          Reporter:  JayKlehr                |         Owner:  adrian
            Status:  closed                  |     Milestone:        
         Component:  Contrib apps            |       Version:  SVN   
        Resolution:  fixed                   |      Keywords:        
             Stage:  Design decision needed  |     Has_patch:  0     
        Needs_docs:  0                       |   Needs_tests:  0     
Needs_better_patch:  0                       |  
---------------------------------------------+------------------------------
Comment (by stephanejais):

 I can see how this can be considered fixed with named urls, although
 I don't manage to have it work.

 Here's my conf:
 {{{
 urlpatterns = patterns('',
     ...
     url(r'^sitemap.xml$', cache_page(sitemap_views.index, 86400),
 kwargs={'sitemaps': sitemaps},
 name="django.contrib.sitemaps.views.index"),
     url(r'^sitemap-(?P<section>.+)\.xml$',
 cache_page(sitemap_views.sitemap, 86400), kwargs={'sitemaps': sitemaps},
 name="django.contrib.sitemaps.views.sitemap"),

 )
 }}}

 Still getting the NoReverseMatch error.
 The problem seems to be this line in the sitemap.views file:
 {{{
 sitemap_url =
 urlresolvers.reverse('django.contrib.sitemaps.views.sitemap',
 kwargs={'section': section})
 }}}
 until 'django.contrib.sitemaps.views.sitemap' is hardcoded there,
 and since it resolves to a valid view function,
 naming my sitemap pattern after the view name doesn't work.

 If I change the name of my url pattern to "foobar", and the reverse call
 in the views file of the sitemap contrib like this:
 {{{
 sitemap_url = urlresolvers.reverse('foobar', kwargs={'section': section})
 }}}

 I get it to work.
 Not very satisfying though.
 Any suggestions ?

-- 
Ticket URL: <http://code.djangoproject.com/ticket/2713#comment:6>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to