From ea39d59863f7d659edb929957936f4aacbd1a2c9 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Tue, 7 Jul 2015 14:53:33 -0300 Subject: [PATCH] Port print statements to python 3 --- legacy/migration.py | 10 +++++----- legacy/scripts/scrap_original_forms.py | 16 ++++++++-------- legacy/scripts/study.py | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/legacy/migration.py b/legacy/migration.py index 523c5a89b..c28c13545 100644 --- a/legacy/migration.py +++ b/legacy/migration.py @@ -80,11 +80,11 @@ def get_renames(): # MIGRATION ################################################################# def info(msg): - print 'INFO: ' + msg + print('INFO: ' + msg) def warn(msg): - print 'WARNING! ' + msg + print('WARNING! ' + msg) special_transforms = {} @@ -186,10 +186,10 @@ def migrate_model(model, to_delete, count_limit=None): legacy_model_name = model_renames.get(model, model.__name__) if legacy_model_name.upper() == 'IGNORE': - print 'Model ignored: %s' % model.__name__ + print('Model ignored: %s' % model.__name__) return - print 'Migrating %s...' % model.__name__ + print('Migrating %s...' % model.__name__) # clear all model entries model.objects.all().delete() @@ -261,4 +261,4 @@ def get_ind_excluido(obj): def check_app_no_ind_excluido(app): for model in app.models.values(): assert not any(get_ind_excluido(obj) for obj in model.objects.all()) - print 'OK!' + print('OK!') diff --git a/legacy/scripts/scrap_original_forms.py b/legacy/scripts/scrap_original_forms.py index 148be25aa..bcd037c34 100644 --- a/legacy/scripts/scrap_original_forms.py +++ b/legacy/scripts/scrap_original_forms.py @@ -62,11 +62,11 @@ def get_names_labels(fieldsets): def print_title_and_fieldsets(model): title, fieldsets = extract_title_and_fieldsets(model) - print '#### %s ####\n' % title + print('#### %s ####\n' % title) for fieldset in fieldsets: - print fieldset['legend'] + print(fieldset['legend']) for line in fieldset['lines']: - print ' ' + ' | '.join('%s : %s' % (id, label) for id, label in line) + print(' ' + ' | '.join('%s : %s' % (id, label) for id, label in line)) def extract_verbose_names(model): @@ -159,7 +159,7 @@ def source_with_verbose_names(model): def print_app_with_verbose_names(app): - print '##################################################################' + print('##################################################################') header = '# -*- coding: utf-8 -*-\n' for line in getsourcelines(app.models_module): if line in ['# -*- coding: utf-8 -*-', @@ -173,14 +173,14 @@ from django.utils.translation import ugettext as _ break else: header += line + '\n' - print header.strip() + print(header.strip()) for model in app.models.values(): - print '\n' + print('\n') for p in source_with_verbose_names(model): - print p + print(p) def list_models_with_no_scrapped_data(app): for model in app.models.values(): if not any(extract_verbose_names(model)[:2]): - print model.__name__ + print(model.__name__) diff --git a/legacy/scripts/study.py b/legacy/scripts/study.py index f6897db31..84ce53ada 100644 --- a/legacy/scripts/study.py +++ b/legacy/scripts/study.py @@ -5,6 +5,6 @@ from migration_base import legacy_app for model in apps.get_app_config('legacy').get_models(): if 'ind_excluido' in [f.name for f in model._meta.fields]: - print model, model.objects.values_list('ind_excluido', flat=True).distinct() + print(model, model.objects.values_list('ind_excluido', flat=True).distinct()) legacy_models_without_ind_excluido = [m for m in legacy_app.models.values() if not any(f.name == 'ind_excluido' for f in m._meta.fields)]