summaryrefslogtreecommitdiff
path: root/website
diff options
context:
space:
mode:
authorJayaram Pai2014-04-29 13:12:40 +0530
committerJayaram Pai2014-04-29 13:12:40 +0530
commitd3d539735c12294d776c1a08718144c484c67d5a (patch)
treeb943ebc28a8853ebe488f4706869502b35f16636 /website
parent5c8db8b5a3e363be63f21700149ef5891410374c (diff)
downloadFOSSEE-Forum-d3d539735c12294d776c1a08718144c484c67d5a.tar.gz
FOSSEE-Forum-d3d539735c12294d776c1a08718144c484c67d5a.tar.bz2
FOSSEE-Forum-d3d539735c12294d776c1a08718144c484c67d5a.zip
excepted NoneType error on login page.
Diffstat (limited to 'website')
-rw-r--r--website/templatetags/nice_bar.py29
1 files changed, 16 insertions, 13 deletions
diff --git a/website/templatetags/nice_bar.py b/website/templatetags/nice_bar.py
index f7fd78c..3abc539 100644
--- a/website/templatetags/nice_bar.py
+++ b/website/templatetags/nice_bar.py
@@ -8,18 +8,21 @@ register = template.Library()
# Showing/Hiding nice-bar on pages
def is_nice_bar_visible(request):
- if request.path == '/':
- return True
- elif "Oscad" in request.path:
- return True
- elif "/question/" in request.path:
- try:
- question_id = request.path[1:-1].split('/')
- question_id = int(question_id[1])
- question = Question.objects.get(pk=question_id)
- if question.category == "Oscad":
- return True
- except:
- return False
+ try:
+ if request.path == '/':
+ return True
+ elif "Oscad" in request.path:
+ return True
+ elif "/question/" in request.path:
+ try:
+ question_id = request.path[1:-1].split('/')
+ question_id = int(question_id[1])
+ question = Question.objects.get(pk=question_id)
+ if question.category == "Oscad":
+ return True
+ except:
+ return False
+ except:
+ return False
return False
register.filter('is_nice_bar_visible', is_nice_bar_visible)