Merge branch 'release/0.2.19'

This commit is contained in:
Jan Dittberner 2013-11-15 21:44:44 +01:00
commit 8cb920e06d
6 changed files with 42 additions and 38 deletions

View file

@ -1,20 +1,11 @@
This file is for you to describe the ddportfolioservice
application. Typically you would include information such as the
information below:
Installation and Setup
======================
This is the source code for the Debian Member Portfolio Service
application [0].
Install ``ddportfolioservice`` using easy_install::
Cf. https://debian-member-portfolio-service.readthedocs.org/ for more
documentation (or its source in docs/source/devdocs.rst), including
how to configure a development environment.
easy_install ddportfolioservice
Make a config file as follows::
[0] http://wiki.debian.org/DDPortfolio
paster make-config ddportfolioservice config.ini
Tweak the config file as appropriate and then setup the application::
paster setup-app config.ini
Then you are ready to go.

View file

@ -26,6 +26,7 @@ given keyring.
"""
import logging
import time
import sys
db = None
cachetimestamp = 0
@ -84,3 +85,25 @@ def getLoginByFingerprint(fpr):
Gets the login associated with the given fingerprint if available.
"""
return _get_cached('login:fpr:%s' % fpr)
def _dump_cache():
cache = _get_keyring_cache()
fprs = []
for key in cache.keys():
if key.startswith('email:fpr:'):
fpr = key.replace('email:fpr:', '')
if not fpr in fprs:
fprs.append(fpr)
for fpr in fprs:
login = getLoginByFingerprint(fpr)
email = _get_cached('email:fpr:%s' % fpr)
name = _get_cached('name:fpr:%s' % fpr)
print fpr, login, ':'
print ' ', name, email
if __name__ == '__main__':
logging.basicConfig(stream=sys.stderr, level=logging.WARNING)
_dump_cache()

View file

@ -35,6 +35,7 @@ import os.path
import logging
import subprocess
import sys
import email.utils
def _get_keyrings():
@ -58,22 +59,8 @@ def _parse_uid(uid):
Parse a uid of the form 'Real Name <email@example.com>' into email
and realname parts.
"""
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('>')
email = None
if s >= 0 and e >= 0:
email = uid[s + 1:e]
uid = uid[:s] + uid[e + 1:]
uid = uid.strip()
if not email and uid.find('@') >= 0:
email, uid = uid, email
return (uid, email)
(uid, mail) = email.utils.parseaddr(uid)
return (uid, mail)
resultdict = {}
@ -85,6 +72,7 @@ def _get_canonical(key):
def _add_to_result(key, newvalue):
logging.debug("adding %s: %s", key, newvalue)
thekey = _get_canonical(key)
if newvalue not in resultdict[thekey]:
resultdict[thekey].append(newvalue)
@ -95,10 +83,10 @@ def process_keyrings():
file."""
for keyring in _get_keyrings():
logging.debug("get data from %s", keyring)
proc = subprocess.Popen(["gpg", "--no-default-keyring",
proc = subprocess.Popen(["gpg", "--no-options", "--no-default-keyring",
"--no-expensive-trust-checks",
"--keyring", keyring, "--list-keys",
"--with-colons", "--fingerprint"],
"--with-colons", "--fixed-list-mode", "--with-fingerprint", "--with-fingerprint"],
stdout=subprocess.PIPE)
fpr = None
entry = None
@ -108,12 +96,13 @@ def process_keyrings():
uid = None
if items[0] == 'pub':
fpr = entry = None
lastpub = items[9].strip()
lastpub = items[4].strip()
continue
elif items[0] == 'fpr':
fpr = items[9].strip()
uid = lastpub
elif items[0] == 'uid':
if items[1] == 'r':
continue
uid = items[9].strip()
else:
continue

View file

@ -50,9 +50,9 @@ copyright = u'2009-2013, Jan Dittberner'
# built documents.
#
# The short X.Y version.
version = '0.2.18.1'
version = '0.2.19'
# The full version, including alpha/beta/rc tags.
release = '0.2.18'
release = '0.2.19'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View file

@ -8,6 +8,7 @@ Code
* Jan Dittberner <jandd at debian dot org>
* Paul Wise <pabs at debian dot org>
* Olivier Berger <olivier.berger at telecom-sudparis dot eu>
Translations
------------

View file

@ -29,7 +29,7 @@ except ImportError:
setup(
name='ddportfolioservice',
version='0.2.18.1',
version='0.2.19',
description='service to create DDPortfolio URLs',
long_description="""This is a service implementation that
returns a set of personalized URLs as outlined in