summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2005-09-27 16:34:10 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2005-09-27 16:34:10 +0000
commitcd34c163cc862113da5b27bf9f5ff452f538fb2c (patch)
tree8dc8fdbaa3c5b0aa579c68b1a858906f6464da17
parent8b67f5f829a998c860e107173584dcc4346d1225 (diff)
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
-rw-r--r--django/conf/global_settings.py3
-rw-r--r--django/core/validators.py8
2 files changed, 7 insertions, 4 deletions
diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
index 9876713718..449d25d01e 100644
--- a/django/conf/global_settings.py
+++ b/django/conf/global_settings.py
@@ -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 #
##############
diff --git a/django/core/validators.py b/django/core/validators.py
index 6714bfda3e..697c2efe81 100644
--- a/django/core/validators.py
+++ b/django/core/validators.py
@@ -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)