Merlijn van Deen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/105496


Change subject: Work around missing authors & missing mail addresses
......................................................................

Work around missing authors & missing mail addresses

Change-Id: I12d782bcc3c62d74c08de7605bc4a94987bfbffd
---
M jira.py
1 file changed, 9 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/sf-export 
refs/changes/96/105496/1

diff --git a/jira.py b/jira.py
index 405b38a..37c6bbb 100644
--- a/jira.py
+++ b/jira.py
@@ -125,6 +125,8 @@
 
 def getBZuser(email, name):
     global users
+    if not email:
+        email = name + "@invalid"
     if email in users:
         return users[email]
 
@@ -178,7 +180,8 @@
     maillist[fields['reporter']['emailAddress']] = 
fields['reporter']['displayName']
 
     for c in fields['comment']['comments']:
-        maillist[c['author']['emailAddress']] = c['author']['displayName']
+        if 'author' in c:
+            maillist[c['author']['emailAddress']] = c['author']['displayName']
 
 print "Retrieving users from bugzilla..."
 
@@ -254,8 +257,11 @@
     natt = 0
     for comment,renderedComment in zip(fields['comment']['comments'], 
renderedFields['comment']['comments']):
         ncs += 1
-        cclist.add(getBZuser(comment['author']['emailAddress'], 
comment['author']['displayName']))
-        commenttext = 
"""-------------------------------------------------------------------------------
+        if 'author' in comment:
+            cclist.add(getBZuser(comment['author']['emailAddress'], 
comment['author']['displayName']))
+        else:
+            comment['author'] = {'displayName': "Anonymous", 'emailAddress': 
'None'}
+        commenttext = 
u"""-------------------------------------------------------------------------------
 From: {f[author][displayName]} <{f[author][emailAddress]}>
 Date: {f[created]:%a, %d %b %Y %T}
 -------------------------------------------------------------------------------

-- 
To view, visit https://gerrit.wikimedia.org/r/105496
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I12d782bcc3c62d74c08de7605bc4a94987bfbffd
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/sf-export
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <valhall...@arctus.nl>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to