diff --git a/helpdesk/management/commands/create_escalation_exclusions.py b/helpdesk/management/commands/create_escalation_exclusions.py index 52db4f85..089e9b26 100644 --- a/helpdesk/management/commands/create_escalation_exclusions.py +++ b/helpdesk/management/commands/create_escalation_exclusions.py @@ -8,6 +8,7 @@ scripts/create_escalation_exclusion.py - Easy way to routinely add particular days to the list of days on which no escalation should take place. """ +from __future__ import print_function from datetime import timedelta, date import getopt @@ -96,23 +97,24 @@ def create_exclusions(days, occurrences, verbose, queues): esc.save() if verbose: - print "Created exclusion for %s %s" % (day_name, workdate) + print("Created exclusion for %s %s" % (day_name, workdate)) for q in queues: esc.queues.add(q) if verbose: - print " - for queue %s" % q + print(" - for queue %s" % q) i += 1 workdate += timedelta(days=1) def usage(): - print "Options:" - print " --days, -d: Days of week (monday, tuesday, etc)" - print " --occurrences, -o: Occurrences: How many weeks ahead to exclude this day" - print " --queues, -q: Queues to include (default: all). Use queue slugs" - print " --verbose, -v: Display a list of dates excluded" + print("Options:") + print(" --days, -d: Days of week (monday, tuesday, etc)") + print(" --occurrences, -o: Occurrences: How many weeks ahead to exclude this day") + print(" --queues, -q: Queues to include (default: all). Use queue slugs") + print(" --verbose, -v: Display a list of dates excluded") + if __name__ == '__main__': @@ -150,7 +152,7 @@ if __name__ == '__main__': try: q = Queue.objects.get(slug__exact=queue) except Queue.DoesNotExist: - print "Queue %s does not exist." % queue + print("Queue %s does not exist." % queue) sys.exit(2) queues.append(q) diff --git a/helpdesk/management/commands/escalate_tickets.py b/helpdesk/management/commands/escalate_tickets.py index 37558f95..9212813b 100644 --- a/helpdesk/management/commands/escalate_tickets.py +++ b/helpdesk/management/commands/escalate_tickets.py @@ -7,6 +7,7 @@ django-helpdesk - A Django powered ticket tracker for small enterprise. scripts/escalate_tickets.py - Easy way to escalate tickets based on their age, designed to be run from Cron or similar. """ +from __future__ import print_function from datetime import timedelta, date import getopt @@ -85,7 +86,7 @@ def escalate_tickets(queues, verbose): req_last_escl_date = date.today() - timedelta(days=days) if verbose: - print "Processing: %s" % q + print("Processing: %s" % q) for t in q.ticket_set.filter( Q(status=Ticket.OPEN_STATUS) @@ -134,11 +135,12 @@ def escalate_tickets(queues, verbose): ) if verbose: - print " - Esclating %s from %s>%s" % ( + print(" - Esclating %s from %s>%s" % ( t.ticket, t.priority+1, t.priority ) + ) f = FollowUp( ticket = t, @@ -159,9 +161,9 @@ def escalate_tickets(queues, verbose): def usage(): - print "Options:" - print " --queues: Queues to include (default: all). Use queue slugs" - print " --verboseescalation: Display a list of dates excluded" + print("Options:") + print(" --queues: Queues to include (default: all). Use queue slugs") + print(" --verboseescalation: Display a list of dates excluded") if __name__ == '__main__': @@ -187,7 +189,7 @@ if __name__ == '__main__': try: q = Queue.objects.get(slug__exact=queue) except Queue.DoesNotExist: - print "Queue %s does not exist." % queue + print("Queue %s does not exist." % queue) sys.exit(2) queues.append(queue) diff --git a/helpdesk/management/commands/get_email.py b/helpdesk/management/commands/get_email.py index 0335dad6..53cdaa30 100644 --- a/helpdesk/management/commands/get_email.py +++ b/helpdesk/management/commands/get_email.py @@ -9,6 +9,7 @@ scripts/get_email.py - Designed to be run from cron, this script checks the helpdesk, creating tickets from the new messages (or adding to existing tickets if needed) """ +from __future__ import print_function import email import imaplib @@ -83,7 +84,7 @@ def process_email(quiet=False): def process_queue(q, quiet=False): if not quiet: - print "Processing: %s" % q + print("Processing: %s" % q) if q.socks_proxy_type and q.socks_proxy_host and q.socks_proxy_port: try: @@ -252,7 +253,7 @@ def create_object_from_email_message(message, ticket_id, payload, files, quiet): f.save() if not quiet: - print (" [%s-%s] %s" % (ticket.queue.slug, ticket.id, ticket.title,)).encode('ascii', 'replace') + print((" [%s-%s] %s" % (ticket.queue.slug, ticket.id, ticket.title,)).encode('ascii', 'replace')) for file in files: if file['content']: @@ -267,7 +268,7 @@ def create_object_from_email_message(message, ticket_id, payload, files, quiet): a.file.save(filename, ContentFile(file['content']), save=False) a.save() if not quiet: - print " - %s" % filename + print(" - %s" % filename) context = safe_template_context(ticket) diff --git a/setup.py b/setup.py index bd82c690..54166479 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,5 @@ +from __future__ import print_function + import os import sys from distutils.util import convert_path @@ -63,9 +65,11 @@ def find_package_data( or fn.lower() == pattern.lower()): bad_name = True if show_ignored: - print >> sys.stderr, ( - "Directory %s ignored by pattern %s" - % (fn, pattern)) + print( + "Directory %s ignored by pattern %s" % (fn, pattern), + file=sys.stderr + ) + break if bad_name: continue @@ -86,9 +90,10 @@ def find_package_data( or fn.lower() == pattern.lower()): bad_name = True if show_ignored: - print >> sys.stderr, ( - "File %s ignored by pattern %s" - % (fn, pattern)) + print( + "File %s ignored by pattern %s" % (fn, pattern), + file=sys.stderr + ) break if bad_name: continue