From a0797ec6f93c02b690d05ef9d4b50acc5933b365 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Thu, 24 Jun 2010 11:47:41 +0200 Subject: [PATCH] Don't print to stdout in when creating default error templates, if verbosity = 0. --- dbtemplates/management/commands/create_error_templates.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dbtemplates/management/commands/create_error_templates.py b/dbtemplates/management/commands/create_error_templates.py index 63a3e16..dd625de 100644 --- a/dbtemplates/management/commands/create_error_templates.py +++ b/dbtemplates/management/commands/create_error_templates.py @@ -37,6 +37,8 @@ class Command(NoArgsCommand): except Site.DoesNotExist: raise CommandError("Please make sure to have the sites contrib " "app installed and setup with a site object") + + verbosity = int(options.get('verbosity', 1)) for error_code in (404, 500): template, created = Template.objects.get_or_create( name="%s.html" % error_code) @@ -44,6 +46,8 @@ class Command(NoArgsCommand): template.content = TEMPLATES.get(error_code, '') template.save() template.sites.add(site) - print "Created database template for %s errors." % error_code + if verbosity >= 1: + self.stdout.write("Created database template for %s errors.\n" % error_code) else: - print "A template for %s errors already exists." % error_code + if verbosity >= 1: + self.stderr.write("A template for %s errors already exists.\n" % error_code)