From 24006427d9ee735d4fb8eaccd4c594662f2665e4 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Fri, 2 Sep 2005 18:28:26 +0000 Subject: [PATCH] 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 --- django/core/management.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/django/core/management.py b/django/core/management.py index 74733a7a4b..b1f1615195 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -495,11 +495,11 @@ class ModelErrorCollection: 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):