forked from jan/debianmemberportfolio
Merge branch 'release/0.2.19'
This commit is contained in:
commit
8cb920e06d
6 changed files with 42 additions and 38 deletions
21
README.txt
21
README.txt
|
@ -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.
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ given keyring.
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
import sys
|
||||||
|
|
||||||
db = None
|
db = None
|
||||||
cachetimestamp = 0
|
cachetimestamp = 0
|
||||||
|
@ -84,3 +85,25 @@ def getLoginByFingerprint(fpr):
|
||||||
Gets the login associated with the given fingerprint if available.
|
Gets the login associated with the given fingerprint if available.
|
||||||
"""
|
"""
|
||||||
return _get_cached('login:fpr:%s' % fpr)
|
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()
|
||||||
|
|
|
@ -35,6 +35,7 @@ import os.path
|
||||||
import logging
|
import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
import email.utils
|
||||||
|
|
||||||
|
|
||||||
def _get_keyrings():
|
def _get_keyrings():
|
||||||
|
@ -58,22 +59,8 @@ def _parse_uid(uid):
|
||||||
Parse a uid of the form 'Real Name <email@example.com>' into email
|
Parse a uid of the form 'Real Name <email@example.com>' into email
|
||||||
and realname parts.
|
and realname parts.
|
||||||
"""
|
"""
|
||||||
uid = uid.strip()
|
(uid, mail) = email.utils.parseaddr(uid)
|
||||||
# First, strip comment
|
return (uid, mail)
|
||||||
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)
|
|
||||||
|
|
||||||
resultdict = {}
|
resultdict = {}
|
||||||
|
|
||||||
|
@ -85,6 +72,7 @@ def _get_canonical(key):
|
||||||
|
|
||||||
|
|
||||||
def _add_to_result(key, newvalue):
|
def _add_to_result(key, newvalue):
|
||||||
|
logging.debug("adding %s: %s", key, newvalue)
|
||||||
thekey = _get_canonical(key)
|
thekey = _get_canonical(key)
|
||||||
if newvalue not in resultdict[thekey]:
|
if newvalue not in resultdict[thekey]:
|
||||||
resultdict[thekey].append(newvalue)
|
resultdict[thekey].append(newvalue)
|
||||||
|
@ -95,10 +83,10 @@ def process_keyrings():
|
||||||
file."""
|
file."""
|
||||||
for keyring in _get_keyrings():
|
for keyring in _get_keyrings():
|
||||||
logging.debug("get data from %s", keyring)
|
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",
|
"--no-expensive-trust-checks",
|
||||||
"--keyring", keyring, "--list-keys",
|
"--keyring", keyring, "--list-keys",
|
||||||
"--with-colons", "--fingerprint"],
|
"--with-colons", "--fixed-list-mode", "--with-fingerprint", "--with-fingerprint"],
|
||||||
stdout=subprocess.PIPE)
|
stdout=subprocess.PIPE)
|
||||||
fpr = None
|
fpr = None
|
||||||
entry = None
|
entry = None
|
||||||
|
@ -108,12 +96,13 @@ def process_keyrings():
|
||||||
uid = None
|
uid = None
|
||||||
if items[0] == 'pub':
|
if items[0] == 'pub':
|
||||||
fpr = entry = None
|
fpr = entry = None
|
||||||
lastpub = items[9].strip()
|
lastpub = items[4].strip()
|
||||||
continue
|
continue
|
||||||
elif items[0] == 'fpr':
|
elif items[0] == 'fpr':
|
||||||
fpr = items[9].strip()
|
fpr = items[9].strip()
|
||||||
uid = lastpub
|
|
||||||
elif items[0] == 'uid':
|
elif items[0] == 'uid':
|
||||||
|
if items[1] == 'r':
|
||||||
|
continue
|
||||||
uid = items[9].strip()
|
uid = items[9].strip()
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -50,9 +50,9 @@ copyright = u'2009-2013, Jan Dittberner'
|
||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = '0.2.18.1'
|
version = '0.2.19'
|
||||||
# The full version, including alpha/beta/rc tags.
|
# 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
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
|
|
|
@ -8,6 +8,7 @@ Code
|
||||||
|
|
||||||
* Jan Dittberner <jandd at debian dot org>
|
* Jan Dittberner <jandd at debian dot org>
|
||||||
* Paul Wise <pabs at debian dot org>
|
* Paul Wise <pabs at debian dot org>
|
||||||
|
* Olivier Berger <olivier.berger at telecom-sudparis dot eu>
|
||||||
|
|
||||||
Translations
|
Translations
|
||||||
------------
|
------------
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -29,7 +29,7 @@ except ImportError:
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='ddportfolioservice',
|
name='ddportfolioservice',
|
||||||
version='0.2.18.1',
|
version='0.2.19',
|
||||||
description='service to create DDPortfolio URLs',
|
description='service to create DDPortfolio URLs',
|
||||||
long_description="""This is a service implementation that
|
long_description="""This is a service implementation that
|
||||||
returns a set of personalized URLs as outlined in
|
returns a set of personalized URLs as outlined in
|
||||||
|
|
Loading…
Reference in a new issue