Fix exeception for templetags (works on django 1.7/py3.4 & django 1.6/py2.7)

This commit is contained in:
Emmanuel Cohen 2015-04-28 14:50:49 +02:00
parent 93cb72f3ec
commit b0db7aa666
2 changed files with 12 additions and 12 deletions

View File

@ -9,13 +9,13 @@ from django.template import Library
from helpdesk import settings as helpdesk_settings_config
def load_helpdesk_settings(request):
# try:
try:
return helpdesk_settings_config
# except Exception, e:
# import sys
# print >> sys.stderr, "'load_helpdesk_settings' template tag (django-helpdesk) crashed with following error:"
# print >> sys.stderr, e
# return ''
except Exception as e:
import sys
print >> sys.stderr, "'load_helpdesk_settings' template tag (django-helpdesk) crashed with following error:"
print >> sys.stderr, e
return ''
register = Library()
register.filter('load_helpdesk_settings', load_helpdesk_settings)

View File

@ -12,14 +12,14 @@ from helpdesk.models import SavedSearch
def saved_queries(user):
# try:
try:
user_saved_queries = SavedSearch.objects.filter(Q(user=user) | Q(shared__exact=True))
return user_saved_queries
# except Exception, e:
# import sys
# print >> sys.stderr, "'saved_queries' template tag (django-helpdesk) crashed with following error:"
# print >> sys.stderr, e
# return ''
except Exception as e:
import sys
print >> sys.stderr, "'saved_queries' template tag (django-helpdesk) crashed with following error:"
print >> sys.stderr, e
return ''
register = Library()
register.filter('saved_queries', saved_queries)