Moved the EventQuerySet to its own class instead of nesting it in the Event model.
[philo.git] / validators.py
index 5f69f74..8b39abd 100644 (file)
@@ -1,12 +1,12 @@
 from django.utils.translation import ugettext_lazy as _
 from django.core.validators import RegexValidator
 from django.core.exceptions import ValidationError
-from django.template import Template, Parser, Lexer, TOKEN_BLOCK, TOKEN_VAR
+from django.template import Template, Parser, Lexer, TOKEN_BLOCK, TOKEN_VAR, TemplateSyntaxError
 from django.utils import simplejson as json
 import re
+from philo.utils import LOADED_TEMPLATE_ATTR
 
 
-LOADED_TEMPLATE_ATTR = '_philo_loaded_template'
 INSECURE_TAGS = (
        'load',
        'extends',
@@ -45,8 +45,8 @@ class URLLinkValidator(RegexValidator):
 def json_validator(value):
        try:
                json.loads(value)
-       except:
-               raise ValidationError(u'\'%s\' is not valid JSON' % value)
+       except Exception, e:
+               raise ValidationError(u'JSON decode error: %s' % e)
 
 
 class TemplateValidationParser(Parser):