Ticket #10793: sitemaps.patch

File sitemaps.patch, 839 bytes (added by Denis Martinez <deuns.martinez@…>, 15 years ago)

proposed solution for dynamic sitemaps

  • contrib/sitemaps/views.py

    diff -ru django/contrib/sitemaps/views.py django.new/contrib/sitemaps/views.py
    old new  
    99    current_site = Site.objects.get_current()
    1010    sites = []
    1111    protocol = request.is_secure() and 'https' or 'http'
     12    if callable(sitemaps):
     13        sitemaps = sitemaps()
    1214    for section, site in sitemaps.items():
    1315        if callable(site):
    1416            pages = site().paginator.num_pages
     
    2426
    2527def sitemap(request, sitemaps, section=None):
    2628    maps, urls = [], []
     29    if callable(sitemaps):
     30        sitemaps = sitemaps()
    2731    if section is not None:
    2832        if section not in sitemaps:
    2933            raise Http404("No sitemap available for section: %r" % section)
Back to Top