Merge branch 'master' into pylons0.10

* master:
  use unquoted email address for MIA lookup
  mark all patterns that require optional information as optional
  update keyringanalyzer.py copyright information
  use email address for MIA pattern to catch non-DDs
  add support for automatic DM data lookup
  silence keyringanalyzer
  fix path handling in keyringanalyzer
  add flattr button
  add flattr button
This commit is contained in:
Jan Dittberner 2010-06-11 22:17:59 +02:00
commit d5c1fd1a34
6 changed files with 52 additions and 16 deletions

View file

@ -149,12 +149,19 @@ developer name on all bug logs)'),
return render('/showform.mako') return render('/showform.mako')
fields = dddatabuilder.build_data(form_result['email']) fields = dddatabuilder.build_data(form_result['email'])
rp = request.params.copy() rp = request.params.copy()
if fields['isdd']:
for tuple in (('name', 'name'), DM_TUPLES = (('name', 'name'),
('gpgfp', 'gpgfp'), ('gpgfp', 'gpgfp'),
('username', 'username'), ('nonddemail', 'email'))
('aliothusername', 'username'), DD_TUPLES = (('username', 'username'),
('nonddemail', 'email')): ('aliothusername', 'username'))
if fields['type'] in (dddatabuilder.TYPE_DD, dddatabuilder.TYPE_DM):
for tuple in DM_TUPLES:
if not tuple[0] in rp or not rp[tuple[0]]:
rp[tuple[0]] = fields[tuple[1]]
if fields['type'] == dddatabuilder.TYPE_DD:
for tuple in DD_TUPLES:
if not tuple[0] in rp or not rp[tuple[0]]: if not tuple[0] in rp or not rp[tuple[0]]:
rp[tuple[0]] = fields[tuple[1]] rp[tuple[0]] = fields[tuple[1]]

View file

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# DDPortfolio service DD data builder # DDPortfolio service DD data builder
# Copyright (c) 2009 Jan Dittberner <jan@dittberner.info> # Copyright © 2009, 2010 Jan Dittberner <jan@dittberner.info>
# #
# This file is part of DDPortfolio service. # This file is part of DDPortfolio service.
# #
@ -20,8 +20,14 @@
# License along with this program. If not, see # License along with this program. If not, see
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.
# #
"""This file contains code to build a representation of a person based
on keyring data associated to a given email address."""
from ddportfolioservice.model import keyfinder from ddportfolioservice.model import keyfinder
TYPE_NO = 0
TYPE_DM = 1
TYPE_DD = 2
def build_data(email_address): def build_data(email_address):
"""Build a DD data structure from a given email address.""" """Build a DD data structure from a given email address."""
@ -32,7 +38,9 @@ def build_data(email_address):
('username', keyfinder.getLoginByEmail)]]) ('username', keyfinder.getLoginByEmail)]])
fields['email'] = email_address fields['email'] = email_address
if fields['username'] and fields['gpgfp'] and fields['name']: if fields['username'] and fields['gpgfp'] and fields['name']:
fields['isdd'] = 1 fields['type'] = TYPE_DD
elif fields['name'] and fields['gpgfp']:
fields['type'] = TYPE_DM
else: else:
fields['isdd'] = 0 fields['type'] = TYPE_NO
return fields return fields

View file

@ -54,6 +54,7 @@ patchtracker.pattern=http://patch-tracker.debian.org/email/%(email)s
[upload] [upload]
urls=keylog urls=keylog
keylog.pattern=http://merkel.debian.org/~enrico/keylog/%(gpgfp)s.html keylog.pattern=http://merkel.debian.org/~enrico/keylog/%(gpgfp)s.html
keylog.optional=true
[lists] [lists]
urls=dolists,adolists,gmane urls=dolists,adolists,gmane
@ -69,13 +70,17 @@ gmane.pattern=http://search.gmane.org/?email=%(name)s&amp;group=gmane.linux.debi
[files] [files]
urls=people,alioth urls=people,alioth
people.pattern=http://people.debian.org/~%(username)s/ people.pattern=http://people.debian.org/~%(username)s/
people.optional=true
alioth.pattern=http://alioth.debian.org/~%(aliothusername)s/ alioth.pattern=http://alioth.debian.org/~%(aliothusername)s/
alioth.optional=true
[membership] [membership]
urls=nm,db,alioth,wiki,forum urls=nm,db,alioth,wiki,forum
nm.pattern=https://nm.debian.org/nmstatus.php?email=%(nonddemail)s nm.pattern=https://nm.debian.org/nmstatus.php?email=%(nonddemail)s
db.pattern=http://db.debian.org/search.cgi?uid=%(username)s&amp;dosearch=Search db.pattern=http://db.debian.org/search.cgi?uid=%(username)s&amp;dosearch=Search
db.optional=true
alioth.pattern=http://alioth.debian.org/users/%(aliothusername)s/ alioth.pattern=http://alioth.debian.org/users/%(aliothusername)s/
alioth.optional=true
wiki.pattern=http://wiki.debian.org/%(wikihomepage)s wiki.pattern=http://wiki.debian.org/%(wikihomepage)s
forum.pattern=http://forums.debian.net/memberlist.php?mode=viewprofile&u=%(forumsid)d forum.pattern=http://forums.debian.net/memberlist.php?mode=viewprofile&u=%(forumsid)d
forum.optional=true forum.optional=true
@ -93,12 +98,14 @@ urls=owndndoms,miainfo,groupinfo
# owned *.debian.net domains # owned *.debian.net domains
owndndoms.pattern=ssh merkel.debian.org ldapsearch -u -x -H ldap://db.debian.org -b dc=debian,dc=org uid=%(username)s dnsZoneEntry owndndoms.pattern=ssh merkel.debian.org ldapsearch -u -x -H ldap://db.debian.org -b dc=debian,dc=org uid=%(username)s dnsZoneEntry
owndndoms.type=ssh owndndoms.type=ssh
owndndoms.optional=true
# MIA information # MIA information
miainfo.pattern=ssh merkel.debian.org /srv/qa.debian.org/mia/mia-query %(username)s miainfo.pattern=ssh merkel.debian.org /srv/qa.debian.org/mia/mia-query %(emailnoq)s
miainfo.type=ssh miainfo.type=ssh
# Group information # Group information
groupinfo.pattern=ssh merkel.debian.org id %(username)s groupinfo.pattern=ssh merkel.debian.org id %(username)s
groupinfo.type=ssh groupinfo.type=ssh
groupinfo.optional=true
[ubuntu] [ubuntu]
urls=ubuntudiff urls=ubuntudiff

View file

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# DDPortfolio service application key ring analyzer tool # DDPortfolio service application key ring analyzer tool
# Copyright (c) 2009 Jan Dittberner <jan@dittberner.info> # Copyright © 2009, 2010 Jan Dittberner <jan@dittberner.info>
# #
# This file is part of DDPortfolio service. # This file is part of DDPortfolio service.
# #
@ -31,6 +31,7 @@ import pkg_resources
import glob import glob
import ConfigParser import ConfigParser
import os import os
import os.path
def _get_keyrings(): def _get_keyrings():
@ -38,10 +39,9 @@ def _get_keyrings():
configured in ddportfolio.ini.""" configured in ddportfolio.ini."""
my_config = ConfigParser.ConfigParser() my_config = ConfigParser.ConfigParser()
my_config.readfp(pkg_resources.resource_stream(__name__, 'ddportfolio.ini')) my_config.readfp(pkg_resources.resource_stream(__name__, 'ddportfolio.ini'))
keyrings = glob.glob(my_config.get('DEFAULT', 'keyring.dir') + keyringdir = os.path.expanduser(my_config.get('DEFAULT', 'keyring.dir'))
'/*.gpg') keyrings = glob.glob(os.path.join(keyringdir, '*.gpg'))
keyrings.extend(glob.glob(my_config.get('DEFAULT', 'keyring.dir') + keyrings.extend(glob.glob(os.path.join(keyringdir, '*.pgp')))
'/*.pgp'))
keyrings.sort() keyrings.sort()
return keyrings return keyrings

View file

@ -76,6 +76,7 @@ def build_urls(fields):
if fpr: if fpr:
qfields['gpgfp'] = fpr[0] qfields['gpgfp'] = fpr[0]
qfields['firstchar'] = fields['email'][0].encode('utf8') qfields['firstchar'] = fields['email'][0].encode('utf8')
qfields['emailnoq'] = fields['email'].encode('utf8')
for section in [section.strip() for section in \ for section in [section.strip() for section in \
my_config.get('DEFAULT', my_config.get('DEFAULT',
'urlbuilder.sections').split(',')]: 'urlbuilder.sections').split(',')]:

View file

@ -20,7 +20,7 @@ License along with this program. If not, see
<http://www.gnu.org/licenses/>. <http://www.gnu.org/licenses/>.
</%doc>\ </%doc>\
function updateFields(data, textStatus) { function updateFields(data, textStatus) {
if (data.isdd == 1) { if (data.type == 2) { // DD
$('#name').attr('value', data.name).attr('readonly', 'readonly'); $('#name').attr('value', data.name).attr('readonly', 'readonly');
$('#gpgfp').attr('value', data.gpgfp); $('#gpgfp').attr('value', data.gpgfp);
$('#username').attr('value', data.username).attr( $('#username').attr('value', data.username).attr(
@ -35,6 +35,19 @@ function updateFields(data, textStatus) {
$('#aliothusernamefield').show(); $('#aliothusernamefield').show();
$('#nonddemail').focus().select(); $('#nonddemail').focus().select();
} else if (data.type == 1) { // DM
$('#name').attr('value', data.name).attr('readonly', 'readonly');
$('#gpgfp').attr('value', data.gpgfp);
$('#username').attr('value', '');
$('#nonddemail').attr('value', data.email).focus();
$('#namefield').show();
$('#gpgfpfield').show();
$('#usernamefield').hide();
$('#nonddemailfield').hide();
$('#aliothusernamefield').show();
$('#aliothusername').focus().select();
} else { } else {
$('#nonddemail').attr('value', data.email); $('#nonddemail').attr('value', data.email);
$('#name').removeAttr('readonly'); $('#name').removeAttr('readonly');