]> git.sommitrealweird.co.uk Git - sommitrealweird.git/blobdiff - sommitrealweird/blog/context_processors.py
Changes to make it work with django 1.11 and python3
[sommitrealweird.git] / sommitrealweird / blog / context_processors.py
index bbfc3eae02a2135dc6714e5031a7f22fe53f905e..9505bb961965f5bfad56e996d2ca8d602d68aeba 100644 (file)
@@ -2,6 +2,11 @@ from django.conf import settings
 from blog.models import BlogEntry, BlogSection
 import re
 
 from blog.models import BlogEntry, BlogSection
 import re
 
+def blog_feed(request):
+    return {
+        'BLOG_FEED_ROOT': settings.BLOG_FEED_ROOT,
+    } 
+
 def content_breadcrumb(request):
     path = request.path
     if path[0:len(settings.BLOG_ROOT)] == settings.BLOG_ROOT:
 def content_breadcrumb(request):
     path = request.path
     if path[0:len(settings.BLOG_ROOT)] == settings.BLOG_ROOT:
@@ -12,9 +17,14 @@ def content_breadcrumb(request):
         parts = path.split('/')
 
         if parts[0] == "section":
         parts = path.split('/')
 
         if parts[0] == "section":
-            # Just need to add the section title to the breadcrumb
-            section = BlogSection.objects.get(slug__exact=parts[1])
-            breadcrumb.append({'url': section.get_absolute_url(), 'title': section.title})
+            # Just need to add the section title to the breadcrumb *if* we
+            # actually have a section
+            if len(parts) > 1:
+                try:
+                    section = BlogSection.objects.get(slug__exact=parts[1])
+                    breadcrumb.append({'url': section.get_absolute_url(), 'title': section.title})
+                except:
+                    pass
 
         if len(parts) == 5 and  \
             parts[0].isdigit() and \
 
         if len(parts) == 5 and  \
             parts[0].isdigit() and \