forked from extern/django-helpdesk
Merge pull request #387 from brunotikami/hotfix/make_print_statements_3x_compatible
Make print statements Python 3.x compatible
This commit is contained in:
commit
bd7dca3a19
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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:
|
||||
@ -290,7 +291,7 @@ def ticket_from_message(message, queue, quiet):
|
||||
f.save()
|
||||
|
||||
if not quiet:
|
||||
print (" [%s-%s] %s" % (t.queue.slug, t.id, t.title,)).encode('ascii', 'replace')
|
||||
print((" [%s-%s] %s" % (t.queue.slug, t.id, t.title,)).encode('ascii', 'replace'))
|
||||
|
||||
for file in files:
|
||||
if file['content']:
|
||||
@ -305,7 +306,7 @@ def ticket_from_message(message, queue, 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(t)
|
||||
|
17
setup.py
17
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
|
||||
|
Loading…
Reference in New Issue
Block a user