magic-removal: Changed django.core.management.validate to output 'Skipping validation' message if validation raises ImproperlyConfigured

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1682 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-12-16 02:05:12 +00:00
parent 7e8b3e7d5e
commit f6aa8baf52
1 changed files with 6 additions and 2 deletions

View File

@ -2,6 +2,7 @@
# development-server initialization.
import django
from django.core.exceptions import ImproperlyConfigured
import os, re, sys, textwrap
from optparse import OptionParser
@ -742,8 +743,11 @@ def get_validation_errors(outfile):
def validate(outfile=sys.stdout):
"Validates all installed models."
num_errors = get_validation_errors(outfile)
outfile.write('%s error%s found.\n' % (num_errors, num_errors != 1 and 's' or ''))
try:
num_errors = get_validation_errors(outfile)
outfile.write('%s error%s found.\n' % (num_errors, num_errors != 1 and 's' or ''))
except ImproperlyConfigured:
outfile.write("Skipping validation because things aren't configured properly.")
validate.args = ''
def runserver(addr, port):