Author: leidel
Date: Sat Feb 28 16:49:57 2009
New Revision: 38

Modified:
    trunk/docs/overview.txt
    trunk/robots/views.py

Log:
Added ability to override sitemap URL in the settings.py.

Modified: trunk/docs/overview.txt
==============================================================================
--- trunk/docs/overview.txt     (original)
+++ trunk/docs/overview.txt     Sat Feb 28 16:49:57 2009
@@ -46,6 +46,11 @@

      ROBOTS_USE_SITEMAP = False

+In case you want to use a specific sitemap URL instead of the one that is
+automatically discovered, change the ``ROBOTS_SITEMAP_URL`` setting to::
+
+    ROBOTS_SITEMAP_URL = http://www.example.com/sitemap.xml
+
  .. _Sitemap contrib app:  
http://docs.djangoproject.com/en/dev/ref/contrib/sitemaps/

  Initialization

Modified: trunk/robots/views.py
==============================================================================
--- trunk/robots/views.py       (original)
+++ trunk/robots/views.py       Sat Feb 28 16:49:57 2009
@@ -8,6 +8,7 @@
  from robots.models import Rule

  USE_SITEMAP = getattr(settings, 'ROBOTS_USE_SITEMAP', True)
+SITEMAP_URL = getattr(settings,'ROBOTS_SITEMAP_URL', False)

  def rules_list(request, template_name='robots/rule_list.html',
          mimetype='text/plain', status_code=200):
@@ -17,13 +18,16 @@
      """
      scheme = request.is_secure() and 'https' or 'http'
      current_site = Site.objects.get_current()
-    try:
-        sitemap_url = reverse('django.contrib.sitemaps.views.index')
-    except NoReverseMatch:
+    if SITEMAP_URL:
+        sitemap_url = SITEMAP_URL
+    else:
          try:
-            sitemap_url = reverse('django.contrib.sitemaps.views.sitemap')
+            sitemap_url = reverse('django.contrib.sitemaps.views.index')
          except NoReverseMatch:
-            sitemap_url = None
+            try:
+                sitemap_url =  
reverse('django.contrib.sitemaps.views.sitemap')
+            except NoReverseMatch:
+                sitemap_url = None
      if sitemap_url is not None and USE_SITEMAP:
          sitemap_url = "%s://%s%s" % (scheme, current_site.domain,  
sitemap_url)
      rules = Rule.objects.filter(sites=current_site)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to