Skip to content

Commit

Permalink
Moved JING from django.core.validators into settings where it belongs.
Browse files Browse the repository at this point in the history
…Fixes #568.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@712 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
jacobian committed Sep 27, 2005
1 parent 8b67f5f commit cd34c16
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions django/conf/global_settings.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@
# loudly. # loudly.
SECRET_KEY = '' SECRET_KEY = ''


# Path to the "jing" executable -- needed to validate XMLFields
JING_PATH = "/usr/bin/jng"

############## ##############
# MIDDLEWARE # # MIDDLEWARE #
############## ##############
Expand Down
8 changes: 4 additions & 4 deletions django/core/validators.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
phone_re = re.compile(r'^[A-PR-Y0-9]{3}-[A-PR-Y0-9]{3}-[A-PR-Y0-9]{4}$', re.IGNORECASE) 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+$') url_re = re.compile(r'^http://\S+$')


JING = '/usr/bin/jing' from django.conf.settings import JING_PATH


class ValidationError(Exception): class ValidationError(Exception):
def __init__(self, message): def __init__(self, message):
Expand Down Expand Up @@ -435,9 +435,9 @@ def __call__(self, field_data, all_data):
fp = open(filename, 'w') fp = open(filename, 'w')
fp.write(field_data) fp.write(field_data)
fp.close() fp.close()
if not os.path.exists(JING): if not os.path.exists(JING_PATH):
raise Exception, "%s not found!" % JING raise Exception, "%s not found!" % JING_PATH
p = os.popen('%s -c %s %s' % (JING, self.schema_path, filename)) p = os.popen('%s -c %s %s' % (JING_PATH, self.schema_path, filename))
errors = [line.strip() for line in p.readlines()] errors = [line.strip() for line in p.readlines()]
p.close() p.close()
os.unlink(filename) os.unlink(filename)
Expand Down

0 comments on commit cd34c16

Please sign in to comment.