Moved JING from django.core.validators into settings where it belongs. Fixes #568.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@712 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2005-09-27 16:34:10 +00:00
parent 8b67f5f829
commit cd34c163cc
2 changed files with 7 additions and 4 deletions

View File

@ -109,6 +109,9 @@ IGNORABLE_404_ENDS = ('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi', 'fav
# loudly.
SECRET_KEY = ''
# Path to the "jing" executable -- needed to validate XMLFields
JING_PATH = "/usr/bin/jng"
##############
# MIDDLEWARE #
##############

View File

@ -23,7 +23,7 @@ ip4_re = re.compile(r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$')
phone_re = re.compile(r'^[A-PR-Y0-9]{3}-[A-PR-Y0-9]{3}-[A-PR-Y0-9]{4}$', re.IGNORECASE)
url_re = re.compile(r'^http://\S+$')
JING = '/usr/bin/jing'
from django.conf.settings import JING_PATH
class ValidationError(Exception):
def __init__(self, message):
@ -435,9 +435,9 @@ class RelaxNGCompact:
fp = open(filename, 'w')
fp.write(field_data)
fp.close()
if not os.path.exists(JING):
raise Exception, "%s not found!" % JING
p = os.popen('%s -c %s %s' % (JING, self.schema_path, filename))
if not os.path.exists(JING_PATH):
raise Exception, "%s not found!" % JING_PATH
p = os.popen('%s -c %s %s' % (JING_PATH, self.schema_path, filename))
errors = [line.strip() for line in p.readlines()]
p.close()
os.unlink(filename)