Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed django.core.management.validate to take an optional 'outfile'…

… argument, defaulting to sys.stdout

git-svn-id: http://code.djangoproject.com/svn/django/trunk@608 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 24006427d9ee735d4fb8eaccd4c594662f2665e4 1 parent 59b2045
@adrianholovaty adrianholovaty authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 django/core/management.py
View
6 django/core/management.py
@@ -495,11 +495,11 @@ def add(self, opts, error):
self.errors.append((opts, error))
self.outfile.write("%s.%s: %s\n" % (opts.app_label, opts.module_name, error))
-def validate():
+def validate(outfile=sys.stdout):
"Validates all installed models."
import django.models
from django.core import meta
- e = ModelErrorCollection()
+ e = ModelErrorCollection(outfile)
module_list = meta.get_installed_model_modules()
for module in module_list:
for mod in module._MODELS:
@@ -545,7 +545,7 @@ def validate():
pass
num_errors = len(e.errors)
- print '%s error%s found.' % (num_errors, num_errors != 1 and 's' or '')
+ outfile.write('%s error%s found.\n' % (num_errors, num_errors != 1 and 's' or ''))
validate.args = ''
def runserver(addr, port):
Please sign in to comment.
Something went wrong with that request. Please try again.