diff --git a/django/core/management/commands/flush.py b/django/core/management/commands/flush.py
index bcadb96..93b7f83 100644
a
|
b
|
The full error: %s""" % (connection.settings_dict['NAME'], e))
|
79 | 79 | call_command('loaddata', 'initial_data', **kwargs) |
80 | 80 | |
81 | 81 | else: |
82 | | print "Flush cancelled." |
| 82 | return "Flush cancelled.\n" |
diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py
index a244a60..e80457c 100644
a
|
b
|
def find_files(root, ignore_patterns, verbosity, symlinks=False):
|
77 | 77 | norm_filepath = os.path.normpath(os.path.join(dirpath, f)) |
78 | 78 | if is_ignored(norm_filepath, ignore_patterns): |
79 | 79 | if verbosity > 1: |
80 | | sys.stdout.write('ignoring file %s in %s\n' % (f, dirpath)) |
| 80 | self.stdout.write('ignoring file %s in %s\n' % (f, dirpath)) |
81 | 81 | else: |
82 | 82 | all_files.extend([(dirpath, f)]) |
83 | 83 | all_files.sort() |
… |
… |
def copy_plural_forms(msgs, locale, domain, verbosity):
|
101 | 101 | m = plural_forms_re.search(open(django_po, 'rU').read()) |
102 | 102 | if m: |
103 | 103 | if verbosity > 1: |
104 | | sys.stderr.write("copying plural forms: %s\n" % m.group('value')) |
| 104 | self.stderr.write("copying plural forms: %s\n" % m.group('value')) |
105 | 105 | lines = [] |
106 | 106 | seen = False |
107 | 107 | for line in msgs.split('\n'): |
… |
… |
def make_messages(locale=None, domain='django', verbosity='1', all=False,
|
167 | 167 | |
168 | 168 | for locale in languages: |
169 | 169 | if verbosity > 0: |
170 | | print "processing language", locale |
| 170 | self.stdout.write('processing language %s\n' % locale) |
171 | 171 | basedir = os.path.join(localedir, locale, 'LC_MESSAGES') |
172 | 172 | if not os.path.isdir(basedir): |
173 | 173 | os.makedirs(basedir) |
… |
… |
def make_messages(locale=None, domain='django', verbosity='1', all=False,
|
182 | 182 | file_base, file_ext = os.path.splitext(file) |
183 | 183 | if domain == 'djangojs' and file_ext in extensions: |
184 | 184 | if verbosity > 1: |
185 | | sys.stdout.write('processing file %s in %s\n' % (file, dirpath)) |
| 185 | self.stdout.write('processing file %s in %s\n' % (file, dirpath)) |
186 | 186 | src = open(os.path.join(dirpath, file), "rU").read() |
187 | 187 | src = pythonize_re.sub('\n#', src) |
188 | 188 | thefile = '%s.py' % file |
… |
… |
def make_messages(locale=None, domain='django', verbosity='1', all=False,
|
234 | 234 | finally: |
235 | 235 | f.close() |
236 | 236 | if verbosity > 1: |
237 | | sys.stdout.write('processing file %s in %s\n' % (file, dirpath)) |
| 237 | self.stdout.write('processing file %s in %s\n' % (file, dirpath)) |
238 | 238 | cmd = ( |
239 | 239 | 'xgettext -d %s -L Python %s --keyword=gettext_noop ' |
240 | 240 | '--keyword=gettext_lazy --keyword=ngettext_lazy:1,2 ' |
… |
… |
class Command(NoArgsCommand):
|
359 | 359 | extensions = handle_extensions(extensions or ['html']) |
360 | 360 | |
361 | 361 | if verbosity > 1: |
362 | | sys.stdout.write('examining files with the extensions: %s\n' |
| 362 | self.stdout.write('examining files with the extensions: %s\n' |
363 | 363 | % get_text_list(list(extensions), 'and')) |
364 | 364 | |
365 | 365 | make_messages(locale, domain, verbosity, process_all, extensions, symlinks, ignore_patterns, no_wrap, no_obsolete) |
diff --git a/django/core/management/commands/reset.py b/django/core/management/commands/reset.py
index 388045f..703a9d1 100644
a
|
b
|
Hint: Look at the output of 'django-admin.py sqlreset %s'. That's the SQL this c
|
60 | 60 | The full error: %s""" % (app_name, app_name, e)) |
61 | 61 | transaction.commit_unless_managed() |
62 | 62 | else: |
63 | | print "Reset cancelled." |
| 63 | self.stdout.write("Reset cancelled.\n") |
diff --git a/django/core/management/commands/runserver.py b/django/core/management/commands/runserver.py
index b265740..520c5c9 100644
a
|
b
|
class BaseRunserverCommand(BaseCommand):
|
116 | 116 | error_text = ERRORS[e.args[0].args[0]] |
117 | 117 | except (AttributeError, KeyError): |
118 | 118 | error_text = str(e) |
119 | | sys.stderr.write(self.style.ERROR("Error: %s" % error_text) + '\n') |
| 119 | self.stderr.write(self.style.ERROR("Error: %s" % error_text) + '\n') |
120 | 120 | # Need to use an OS exit because sys.exit doesn't work in a thread |
121 | 121 | os._exit(1) |
122 | 122 | except KeyboardInterrupt: |
diff --git a/django/core/management/commands/syncdb.py b/django/core/management/commands/syncdb.py
index a5228a1..be4156f 100644
a
|
b
|
class Command(NoArgsCommand):
|
81 | 81 | |
82 | 82 | # Create the tables for each model |
83 | 83 | if verbosity >= 1: |
84 | | print "Creating tables ..." |
| 84 | self.stdout.write("Creating tables ...\n") |
85 | 85 | for app_name, model_list in manifest.items(): |
86 | 86 | for model in model_list: |
87 | 87 | # Create the model's database table, if it doesn't already exist. |
88 | 88 | if verbosity >= 3: |
89 | | print "Processing %s.%s model" % (app_name, model._meta.object_name) |
| 89 | self.stdout.write("Processing %s.%s model\n" % (app_name, model._meta.object_name)) |
90 | 90 | sql, references = connection.creation.sql_create_model(model, self.style, seen_models) |
91 | 91 | seen_models.add(model) |
92 | 92 | created_models.add(model) |
… |
… |
class Command(NoArgsCommand):
|
96 | 96 | sql.extend(connection.creation.sql_for_pending_references(refto, self.style, pending_references)) |
97 | 97 | sql.extend(connection.creation.sql_for_pending_references(model, self.style, pending_references)) |
98 | 98 | if verbosity >= 1 and sql: |
99 | | print "Creating table %s" % model._meta.db_table |
| 99 | self.stdout.write("Creating table %s\n" % model._meta.db_table) |
100 | 100 | for statement in sql: |
101 | 101 | cursor.execute(statement) |
102 | 102 | tables.append(connection.introspection.table_name_converter(model._meta.db_table)) |
… |
… |
class Command(NoArgsCommand):
|
114 | 114 | # Install custom SQL for the app (but only if this |
115 | 115 | # is a model we've just created) |
116 | 116 | if verbosity >= 1: |
117 | | print "Installing custom SQL ..." |
| 117 | self.stdout.write("Installing custom SQL ...\n") |
118 | 118 | for app_name, model_list in manifest.items(): |
119 | 119 | for model in model_list: |
120 | 120 | if model in created_models: |
121 | 121 | custom_sql = custom_sql_for_model(model, self.style, connection) |
122 | 122 | if custom_sql: |
123 | 123 | if verbosity >= 2: |
124 | | print "Installing custom SQL for %s.%s model" % (app_name, model._meta.object_name) |
| 124 | self.stdout.write("Installing custom SQL for %s.%s model\n" % |
| 125 | (app_name, model._meta.object_name)) |
125 | 126 | try: |
126 | 127 | for sql in custom_sql: |
127 | 128 | cursor.execute(sql) |
128 | 129 | except Exception, e: |
129 | | sys.stderr.write("Failed to install custom SQL for %s.%s model: %s\n" % \ |
| 130 | self.stderr.write("Failed to install custom SQL for %s.%s model: %s\n" % |
130 | 131 | (app_name, model._meta.object_name, e)) |
131 | 132 | if show_traceback: |
132 | 133 | import traceback |
… |
… |
class Command(NoArgsCommand):
|
136 | 137 | transaction.commit_unless_managed(using=db) |
137 | 138 | else: |
138 | 139 | if verbosity >= 3: |
139 | | print "No custom SQL for %s.%s model" % (app_name, model._meta.object_name) |
| 140 | self.stdout.write("No custom SQL for %s.%s model\n" % |
| 141 | (app_name, model._meta.object_name)) |
140 | 142 | |
141 | 143 | if verbosity >= 1: |
142 | | print "Installing indexes ..." |
| 144 | self.stdout.write("Installing indexes ...\n") |
143 | 145 | # Install SQL indicies for all newly created models |
144 | 146 | for app_name, model_list in manifest.items(): |
145 | 147 | for model in model_list: |
… |
… |
class Command(NoArgsCommand):
|
147 | 149 | index_sql = connection.creation.sql_indexes_for_model(model, self.style) |
148 | 150 | if index_sql: |
149 | 151 | if verbosity >= 2: |
150 | | print "Installing index for %s.%s model" % (app_name, model._meta.object_name) |
| 152 | self.stdout.write("Installing index for %s.%s model\n" % |
| 153 | (app_name, model._meta.object_name)) |
151 | 154 | try: |
152 | 155 | for sql in index_sql: |
153 | 156 | cursor.execute(sql) |
154 | 157 | except Exception, e: |
155 | | sys.stderr.write("Failed to install index for %s.%s model: %s\n" % \ |
| 158 | self.stderr.write("Failed to install index for %s.%s model: %s\n" % \ |
156 | 159 | (app_name, model._meta.object_name, e)) |
157 | 160 | transaction.rollback_unless_managed(using=db) |
158 | 161 | else: |