summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-11-10 19:17:17 +0100
committerMichael Stahl <mstahl@redhat.com>2013-11-11 16:42:21 +0100
commitfdb747ff8c4653d3e94192693f1080398ae20339 (patch)
tree77199f57dd84b3676515b9af64b8c54f4cba4c2e /bin
parent5181dc022334b4a6fc760b6aae4448a014551798 (diff)
get-bugzilla-attachments-by-mimetype: more Python 3 in exception handler
... and also fix the print functions that shouldn't output a newline. Change-Id: Ifd866cb33b3ef9a2e83625ed03d5cb836c1ba56b
Diffstat (limited to 'bin')
-rwxr-xr-xbin/get-bugzilla-attachments-by-mimetype15
1 files changed, 8 insertions, 7 deletions
diff --git a/bin/get-bugzilla-attachments-by-mimetype b/bin/get-bugzilla-attachments-by-mimetype
index e3fb177cde14..15864cfb31fc 100755
--- a/bin/get-bugzilla-attachments-by-mimetype
+++ b/bin/get-bugzilla-attachments-by-mimetype
@@ -18,6 +18,7 @@
#
#where X is the n'th attachment of that type in the bug
+from __future__ import print_function
import feedparser
import base64
import re
@@ -40,7 +41,7 @@ def urlopen_retry(url):
try:
return urlopen(url)
except IOError as e:
- print("caught IOError: " + e)
+ print("caught IOError: " + str(e))
if maxretries == i:
raise
print("retrying...")
@@ -51,17 +52,17 @@ def get_from_bug_url_via_xml(url, mimetype, prefix, suffix):
if os.path.isfile(suffix + '/' + prefix + id + '-1.' + suffix):
print("assuming " + id + " is up to date")
else:
- print("parsing", id)
+ print("parsing " + id)
sock = urlopen_retry(url+"&ctype=xml")
dom = minidom.parse(sock)
sock.close()
attachmentid=0
for attachment in dom.getElementsByTagName('attachment'):
attachmentid += 1
- print(" mimetype is")
+ print(" mimetype is", end=' ')
for node in attachment.childNodes:
if node.nodeName == 'type':
- print(node.firstChild.nodeValue)
+ print(node.firstChild.nodeValue, end=' ')
if node.firstChild.nodeValue.lower() != mimetype.lower():
print('skipping')
break
@@ -102,14 +103,14 @@ def get_novell_bug_via_xml(url, mimetype, prefix, suffix):
if not handle:
print("attachment %s is not accessible" % realAttachmentId)
continue
- print(" mimetype is")
+ print(" mimetype is", end=' ')
info = handle.info()
if info.get_content_type:
remoteMime = info.get_content_type()
else:
remoteMime = info.gettype()
- print(remoteMime)
+ print(remoteMime, end=' ')
if remoteMime != mimetype:
print("skipping")
continue
@@ -161,7 +162,7 @@ def get_through_rss_query_url(url, mimetype, prefix, suffix):
except KeyboardInterrupt:
raise # Ctrl+C should work
except:
- print(entry['id'] + " failed: " + sys.exc_info()[0])
+ print(entry['id'] + " failed: " + str(sys.exc_info()[0]))
pass
def get_through_rss_query(queryurl, mimetype, prefix, suffix):