grab-attachments: put attachments in a folder named after the bug number which prevents clobbering of attachments if multiple bugs have the same attachment name

This commit is contained in:
Brian Murray 2011-04-18 11:16:16 -07:00
parent 4dc91f0366
commit d0aa685788

View File

@ -56,6 +56,9 @@ def main():
bug = launchpad.bugs[number]
os.mkdir('bug-%s' % number)
os.chdir('bug-%s' % number)
for attachment in bug.attachments:
f = attachment.data.open()
filename = os.path.join(os.getcwd(), f.filename)
@ -64,6 +67,8 @@ def main():
f.close()
local_file.close()
os.chdir('../')
# no LP credentials
except IOError, error:
print error