diff options
author | Florian Jung <flo@windfisch.org> | 2013-09-03 18:09:18 +0200 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2013-09-03 18:09:18 +0200 |
commit | c737c60d34232dbe25d0c9bd65548ca69d2b40fe (patch) | |
tree | 929099b60b27e16caafb63d800a9ff054fc24a67 | |
parent | 480f8646ae341206ff048ea0540ed0e7aedc539b (diff) |
Cleanup junk from messages
-rwxr-xr-x | issues.py | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -1,5 +1,7 @@ #!/usr/bin/env python +import re + import better_exchook better_exchook.install() @@ -94,6 +96,13 @@ for tracker in trackers: categories.add(category.string) print "categories:", categories +def cleanup_message_body(body): + body=re.sub("Logged In: (YES|NO) *\\n", "", body) + body=re.sub("user_id=[0-9]+ *\\n", "", body) + body=re.sub("Originator: (YES|NO) *\\n", "", body) + return body + + def handle_tracker_item(item, issue_title_prefix): if len(issue_title_prefix) > 0: issue_title_prefix = issue_title_prefix.strip() + " " @@ -157,7 +166,7 @@ def handle_tracker_item(item, issue_title_prefix): commentdate = datetime.fromtimestamp(float(followup.find('field',attrs={'name':'adddate'}).string)) comments.insert(0,'\n\n'.join([ 'Submitted by %s on %s' % (followup.find('field',attrs={'name':'user_name'}).string,str(commentdate)), - followup.find('field',attrs={'name':'body'}).string, + cleanup_message_body(followup.find('field',attrs={'name':'body'}).string), ])) print 'Creating: %s [%s] (%d comments)%s for SF #%s from %s' % (title, ','.join(labels), len(comments), ' (closed)' if closed else '', item_id, item_date) |