Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Replaced print statement by print function #662

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions td/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def skip_row(self, instance, original):
result = super(LanguageAltNameResource, self).skip_row(instance, original)
try:
LanguageAltName.objects.get(code=instance.code, name=instance.name)
print "".join(["*LanguageAltName with code ", instance.code,
" and ", instance.name, " already exist. Skipped."])
print("".join(["*LanguageAltName with code ", instance.code,
" and ", instance.name, " already exist. Skipped."]))
return True
except LanguageAltName.DoesNotExist:
return result
Expand All @@ -97,7 +97,7 @@ def after_save_instance(self, instance, dry_run):
language.source = self.source
language.save()
except Language.DoesNotExist:
print "Language code: " + instance.code + " doesn't exist."
print("Language code: " + instance.code + " doesn't exist.")

class Meta:
model = LanguageAltName
Expand Down
12 changes: 6 additions & 6 deletions td/commenting/management/commands/check_languages.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ def handle(self, *args, **options):

try:
language_codes.index(cc)
print cc
print(cc)
count += 1
except ValueError:
pass

print "%d duplicate(s) found\n" % count
print("%d duplicate(s) found\n" % count)

if len(language_codes) != len(set(language_codes)):
print "internal duplicate(s) found"
Expand All @@ -29,11 +29,11 @@ def handle(self, *args, **options):
mapping[lc] = mapping.get(lc, 0) + 1
for lc in mapping:
if mapping[lc] > 1:
print "%s: %dx" % (lc, mapping[lc])
print "\n"
print("%s: %dx" % (lc, mapping[lc]))
print("\n")

empty_iso_languages = [l for l in Language.objects.all() if (len(l.code) <= 2 and l.iso_639_3 == " ")]
# for l in empty_iso_languages:
# print l
print empty_iso_languages
print "\n"
print(empty_iso_languages)
print("\n")
2 changes: 1 addition & 1 deletion td/gl_tracking/migrations/0014_regionaldirector_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def migrate_user(apps, schema_editor):
rd.user_id = User.objects.get(id=row[1])
rd.save()
except ObjectDoesNotExist:
print "\n" + unicode(row[1]) + " cannot be found in the list of user. Data not migrated."
print("\n" + unicode(row[1]) + " cannot be found in the list of user. Data not migrated.")


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion td/imports/management/commands/reload_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def handle(self, *args, **options):
session = requests.Session()
for obj in models.__dict__.values():
if hasattr(obj, "reload") and callable(obj.reload):
print "Loading {} records".format(obj._meta.verbose_name)
print("Loading {} records".format(obj._meta.verbose_name))
obj.reload(session)
update_countries_from_imports()
integrate_imports()
1 change: 0 additions & 1 deletion td/publishing/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def lookups(self, request, model_admin):
return texts

def queryset(self, request, queryset):
print self.value()
if self.value() == "NoneSelected":
return queryset.filter(source_text__isnull=True)
if self.value():
Expand Down
8 changes: 4 additions & 4 deletions td/publishing/management/commands/add_publishing_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ def handle(self, *args, **options):

# get or create the Publishing auth group
if Group.objects.filter(name='Publishing').exists():
print '* The Publishing group already exists.'
print('* The Publishing group already exists.')
publishing_group = Group.objects.get(name='Publishing')
else:
print '* Creating the Publishing group.'
print('* Creating the Publishing group.')
publishing_group = Group.objects.create(name='Publishing')

# add the initial users
Expand All @@ -27,8 +27,8 @@ def handle(self, *args, **options):
def add_existing_user_to_group(group, user_name):

if not User.objects.filter(username=user_name).exists():
print '* The user ' + user_name + ' was not found.'
print('* The user ' + user_name + ' was not found.')
return

User.objects.get(username=user_name).groups.add(group)
print '* Successfully added ' + user_name + ' to the Publishing group.'
print('* Successfully added ' + user_name + ' to the Publishing group.')
2 changes: 1 addition & 1 deletion td/publishing/management/commands/sync_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ def handle(self, *args, **options):
}
)
if created:
print "Created {}".format(obj.name)
print("Created {}".format(obj.name))
3 changes: 0 additions & 3 deletions td/publishing/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ def get_context_data(self, **kwargs):

def post(self, request, *args, **kwargs):
self.object = self.get_object()
print self.object
print request.user
print request.POST
context = self.get_context_data(object=self.object)
if "recent_com" in request.POST:
form_com = RecentComForm(
Expand Down
1 change: 0 additions & 1 deletion td/resources/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ class ResourceEditView(LoginRequiredMixin, UpdateView):
action_kind = "EDIT"

def get_success_url(self):
print self.object.language.pk
return reverse("language_detail", args=[self.object.language.pk])

def get_context_data(self, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion td/tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def _receiver_in_lookup_keys(self, receiver, lookup_keys):
Evaluate if the receiver is in the provided lookup_keys; instantly terminates when found.
"""
for key in lookup_keys:
# print '%s - %s - %s' % (key[0], receiver[0][1], key[1])
# print('%s - %s - %s' % (key[0], receiver[0][1], key[1]))
if (receiver[0][0] == key[0] or key[0] is None) and receiver[0][1] == key[1]:
return True
return False
Expand Down
2 changes: 1 addition & 1 deletion td/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ def done(self, form_list, **kwargs):
except Country.DoesNotExist:
# NOTE: what's the best way to handle non-existing country? maybe if it's a selectbox, we don't need
# to check this
print "- ERR! Country %s doesn't exist."
print("- ERR! Country %s doesn't exist.")
pass

obj.save()
Expand Down