diff --git a/ddportfolioservice/controllers/ddportfolio.py b/ddportfolioservice/controllers/ddportfolio.py index 4af5597..81fcd55 100644 --- a/ddportfolioservice/controllers/ddportfolio.py +++ b/ddportfolioservice/controllers/ddportfolio.py @@ -109,6 +109,7 @@ developer name on all bug logs)'), 'gpgfinger': N_('GPG public key via finger'), 'gpgweb': N_('GPG public key via HTTP'), 'nm': N_('NM, AM participation'), + 'contrib': N_('Contribution information'), }, 'ssh': { 'label': N_('Information reachable via ssh (for Debian Members)'), diff --git a/ddportfolioservice/model/ddportfolio.ini b/ddportfolioservice/model/ddportfolio.ini index 5c49772..7dd4073 100644 --- a/ddportfolioservice/model/ddportfolio.ini +++ b/ddportfolioservice/model/ddportfolio.ini @@ -86,7 +86,7 @@ forum.pattern=http://forums.debian.net/memberlist.php?mode=viewprofile&u=%(forum forum.optional=true [miscellaneous] -urls=debtags,links,planetname,planetuser,website,search,gpgfinger,gpgweb +urls=debtags,links,planetname,planetuser,website,search,gpgfinger,gpgweb,contrib debtags.pattern=http://debtags.debian.net/reports/maint/%(email)s planetname.pattern=http://planet-search.debian.org/cgi-bin/search.cgi?terms=%%22%(name)s%%22 planetuser.pattern=http://planet-search.debian.org/cgi-bin/search.cgi?terms=%%22%(username)s%%22 @@ -100,6 +100,8 @@ gpgfinger.optional=true gpgweb.pattern=http://db.debian.org/fetchkey.cgi?fingerprint=%(gpgfp)s gpgweb.optional=true nm.pattern=https://nm.debian.org/public/person/%(username)s +contrib.pattern=https://contributors.debian.org/contributors/contributor/%(aliothusername)s +contrib.optional=true [ssh] # SSH functions diff --git a/ddportfolioservice/model/keyringanalyzer.py b/ddportfolioservice/model/keyringanalyzer.py index 9f3aa69..c82772e 100644 --- a/ddportfolioservice/model/keyringanalyzer.py +++ b/ddportfolioservice/model/keyringanalyzer.py @@ -53,14 +53,39 @@ def _get_keyrings(): keyrings.sort() return keyrings - def _parse_uid(uid): """ Parse a uid of the form 'Real Name ' into email and realname parts. """ - (uid, mail) = email.utils.parseaddr(uid) - return (uid, mail) + + # First try with the Python library, but it doesn't always catch everything + (name, mail) = email.utils.parseaddr(uid) + if (not name) and (not mail): + logging.warning("malformed uid %s", uid) + if (not name) or (not mail): + logging.debug("strange uid %s: '%s' - <%s>", uid, name, mail) + # Try and do better than the python library + if not '@' in mail: + uid = uid.strip() + # First, strip comment + s = uid.find('(') + e = uid.find(')') + if s >= 0 and e >= 0: + uid = uid[:s] + uid[e + 1:] + s = uid.find('<') + e = uid.find('>') + mail = None + if s >= 0 and e >= 0: + mail = uid[s + 1:e] + uid = uid[:s] + uid[e + 1:] + uid = uid.strip() + if not mail and uid.find('@') >= 0: + mail, uid = uid, mail + + name = uid + logging.debug("corrected: '%s' - <%s>", name, mail) + return (name, mail) resultdict = {} @@ -107,19 +132,20 @@ def process_keyrings(): else: continue # Do stuff with 'uid' - uid, email = _parse_uid(uid) - if email: - if email.endswith('@debian.org'): - login = email[0:-len('@debian.org')] - _add_to_result('login:email:%s' % email, login) - _add_to_result('login:fpr:%s' % fpr, login) - _add_to_result('fpr:login:%s' % login, fpr) - _add_to_result('fpr:email:%s' % email, fpr) - _add_to_result('email:fpr:%s' % fpr, email) + if uid: + (uid, mail) = _parse_uid(uid) + if mail: + if mail.endswith('@debian.org'): + login = mail[0:-len('@debian.org')] + _add_to_result('login:email:%s' % mail, login) + _add_to_result('login:fpr:%s' % fpr, login) + _add_to_result('fpr:login:%s' % login, fpr) + _add_to_result('fpr:email:%s' % mail, fpr) + _add_to_result('email:fpr:%s' % fpr, mail) if uid: _add_to_result('name:fpr:%s' % fpr, uid) - if email: - _add_to_result('name:email:%s' % email, uid) + if mail: + _add_to_result('name:email:%s' % mail, uid) retcode = proc.wait() if retcode != 0: logging.error("subprocess ended with return code %d", retcode) diff --git a/docs/source/conf.py b/docs/source/conf.py index f00d642..d0d6179 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -50,9 +50,9 @@ copyright = u'2009-2013, Jan Dittberner' # built documents. # # The short X.Y version. -version = '0.2.19' +version = '0.2.20' # The full version, including alpha/beta/rc tags. -release = '0.2.19' +release = '0.2.20' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.py b/setup.py index 1396e1e..5811d7d 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ except ImportError: setup( name='ddportfolioservice', - version='0.2.19', + version='0.2.20', description='service to create DDPortfolio URLs', long_description="""This is a service implementation that returns a set of personalized URLs as outlined in