From 9e7c7fa4b786bf78f656090863e85e00df2480ac Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 12 Feb 2020 13:51:41 -0500 Subject: [PATCH] remove py2 print --- questionnaire/management/commands/make_landing_nonces.py | 3 ++- questionnaire/management/commands/questionnaire_emails.py | 3 ++- questionnaire/profiler.py | 5 +++-- questionnaire/qprocessors/choice.py | 5 ++--- questionnaire/qprocessors/simple.py | 1 - questionnaire/request_cache.py | 4 ++-- questionnaire/views.py | 3 --- 7 files changed, 11 insertions(+), 13 deletions(-) diff --git a/questionnaire/management/commands/make_landing_nonces.py b/questionnaire/management/commands/make_landing_nonces.py index 88fbbae..5d74662 100644 --- a/questionnaire/management/commands/make_landing_nonces.py +++ b/questionnaire/management/commands/make_landing_nonces.py @@ -1,3 +1,4 @@ +from __future__ import print_function from django.core.management.base import BaseCommand from ...models import Landing @@ -10,5 +11,5 @@ class Command(BaseCommand): how_many=int(how_many) while how_many > 0: landing = Landing.objects.create(label = label) - print landing.nonce + print(landing.nonce) how_many -= 1 diff --git a/questionnaire/management/commands/questionnaire_emails.py b/questionnaire/management/commands/questionnaire_emails.py index f8c483e..b28ce50 100644 --- a/questionnaire/management/commands/questionnaire_emails.py +++ b/questionnaire/management/commands/questionnaire_emails.py @@ -1,3 +1,4 @@ +from __future__ import print_function from django.core.management.base import NoArgsCommand class Command(NoArgsCommand): @@ -5,4 +6,4 @@ class Command(NoArgsCommand): from ...emails import send_emails res = send_emails() if res: - print res + print(res) diff --git a/questionnaire/profiler.py b/questionnaire/profiler.py index 9d5f98a..346fec5 100644 --- a/questionnaire/profiler.py +++ b/questionnaire/profiler.py @@ -1,3 +1,4 @@ +from __future__ import print_function import hotshot import os import time @@ -51,7 +52,7 @@ def timethis(fn): def wrapper(*args, **kwargs): start = time.time() result = fn(*args, **kwargs) - print fn.__name__, 'took', time.time() - start + print(fn.__name__, 'took', time.time() - start) return result return wrapper @@ -62,7 +63,7 @@ def sqlprint(fn): def wrapper(*args, **kwargs): connection.queries = list() result = fn(*args, **kwargs) - print fn.__name__, 'issued' + print(fn.__name__, 'issued') pprint(connection.queries) return result return wrapper \ No newline at end of file diff --git a/questionnaire/qprocessors/choice.py b/questionnaire/qprocessors/choice.py index 89cb5dc..8a3fd8e 100644 --- a/questionnaire/qprocessors/choice.py +++ b/questionnaire/qprocessors/choice.py @@ -1,3 +1,4 @@ +from __future__ import print_function from json import dumps import ast from django.utils.translation import ugettext as _, ungettext @@ -84,8 +85,6 @@ def question_multiple(request, question): prev_vals[choice_value] = str(prev_value) possiblelist = pl -# print 'possible value is ', possibledbvalue, ', possiblelist is ', possiblelist - for choice in question.choices(): counter += 1 key = "question_%s_multiple_%d" % (question.number, choice.sortid) @@ -94,7 +93,7 @@ def question_multiple(request, question): # so that the number box will be activated when item is checked #try database first and only after that fall back to post choices -# print 'choice multiple checking for match for choice ', choice +# print('choice multiple checking for match for choice ', choice) checked = ' checked' prev_value = '' qvalue = "%s_%s" % (question.number, choice.value) diff --git a/questionnaire/qprocessors/simple.py b/questionnaire/qprocessors/simple.py index 8a18f65..58558dd 100644 --- a/questionnaire/qprocessors/simple.py +++ b/questionnaire/qprocessors/simple.py @@ -84,7 +84,6 @@ def question_open(request, question): @answer_proc('open', 'open-textfield', 'choice-yesno', 'choice-yesnocomment', 'choice-yesnodontknow','choice-yesno-optional', 'choice-yesnocomment-optional', 'choice-yesnodontknow-optional') def process_simple(question, ansdict): -# print 'process_simple has question, ansdict ', question, ',', ansdict checkdict = question.getcheckdict() ans = ansdict['ANSWER'] or '' qtype = question.get_type() diff --git a/questionnaire/request_cache.py b/questionnaire/request_cache.py index 6c19b21..b981b28 100644 --- a/questionnaire/request_cache.py +++ b/questionnaire/request_cache.py @@ -50,11 +50,11 @@ class request_cache(object): @request_cache() def cached(name): - print "My name is %s and I'm cached" % name + print("My name is %s and I'm cached" % name) @request_cache(keyfn=lambda p: p['id']) def cached(param): - print "My id is %s" % p['id'] + print("My id is %s" % p['id']) If no keyfn is provided the decorator expects the args to be hashable. diff --git a/questionnaire/views.py b/questionnaire/views.py index e98bfc9..002adf7 100644 --- a/questionnaire/views.py +++ b/questionnaire/views.py @@ -166,7 +166,6 @@ def questionnaire(request, runcode=None, qs=None): We only commit on success, to maintain consistency. We also specifically rollback if there were errors processing the answers for this questionset. """ - print translation.get_language() if use_session: session_runcode = request.session.get('runcode', None) @@ -662,7 +661,6 @@ def new_questionnaire(request, item_id): if form.is_valid(): if not item and form.item: item = form.item - print "create landing" landing = Landing.objects.create(label=form.cleaned_data['label'], questionnaire=form.cleaned_data['questionnaire'], content_object=item) return HttpResponseRedirect(reverse('questionnaires')) return render(request, "manage_questionnaire.html", {"item":item, "form":form}) @@ -670,7 +668,6 @@ def new_questionnaire(request, item_id): def questionnaires(request): - print "here" if not request.user.is_authenticated() : return render(request, "questionnaires.html") items = item_model.objects.all()