rev 3567 - scripts
Pierre Habouzit
madcoder at costa.debian.org
Mon Apr 17 16:26:54 UTC 2006
Author: madcoder
Date: 2006-04-17 16:26:53 +0000 (Mon, 17 Apr 2006)
New Revision: 3567
Modified:
scripts/bzlink.py
Log:
drop old BtsMail old stub.
reorganize code.
now send the mail. I tested it on upstream bug #125694, will see if that
worked :D
Modified: scripts/bzlink.py
===================================================================
--- scripts/bzlink.py 2006-04-17 16:19:02 UTC (rev 3566)
+++ scripts/bzlink.py 2006-04-17 16:26:53 UTC (rev 3567)
@@ -127,20 +127,7 @@
return '\n'.join(btscmds)
return None
-class BtsMail(MIMEText):
- def __init__(self, bzm, btsbug, From):
- pass
-
-patterns = [ "http://bugs.kde.org/show_bug.cgi?id=%i",
- "http://bugs.kde.org/%i",
- "%i at bugs.kde.org" ]
-
-if __name__ == "__main__":
- bzm = BzMsg(sys.stdin)
-
- bts = BtsQuery()
- bug = bts.fromBzBug(patterns, bzm.bug)['debbugsID'][0]
-
+def createMail(bzm, bug):
cmds = bzm.createCmds(bug)
to = []
@@ -166,7 +153,29 @@
except:
mail['Content-Type'] = 'text/plain; charset="utf-8"'
- print mail
+ return mail
+patterns = [ "http://bugs.kde.org/show_bug.cgi?id=%i",
+ "http://bugs.kde.org/%i",
+ "%i at bugs.kde.org" ]
+if __name__ == "__main__":
+ bzm = BzMsg(sys.stdin)
+
+ bts = BtsQuery()
+ bug = bts.fromBzBug(patterns, bzm.bug)
+
+ if bug is None:
+ # TODO: put the message in a queue for later processing
+ sys.exit(1)
+ else:
+ bug = bug['debbugsID'][0]
+
+ msg = createMail(bzm, bug)
+
+ s = smtplib.SMTP()
+ s.connect()
+ s.sendmail(msg['From'], msg['To'].split(', '), msg.as_string())
+ s.close()
+
# vim:set foldmethod=indent foldnestmax=1:
More information about the pkg-kde-commits
mailing list