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:
parent
7e8b3e7d5e
commit
f6aa8baf52
|
@ -2,6 +2,7 @@
|
||||||
# development-server initialization.
|
# development-server initialization.
|
||||||
|
|
||||||
import django
|
import django
|
||||||
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
import os, re, sys, textwrap
|
import os, re, sys, textwrap
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
|
@ -742,8 +743,11 @@ def get_validation_errors(outfile):
|
||||||
|
|
||||||
def validate(outfile=sys.stdout):
|
def validate(outfile=sys.stdout):
|
||||||
"Validates all installed models."
|
"Validates all installed models."
|
||||||
|
try:
|
||||||
num_errors = get_validation_errors(outfile)
|
num_errors = get_validation_errors(outfile)
|
||||||
outfile.write('%s error%s found.\n' % (num_errors, num_errors != 1 and 's' or ''))
|
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 = ''
|
validate.args = ''
|
||||||
|
|
||||||
def runserver(addr, port):
|
def runserver(addr, port):
|
||||||
|
|
Loading…
Reference in New Issue