forked from jan/debianmemberportfolio
add labels for HTML output
- add translatable labels for HTML output (not used for JSON yet) - add oldpeople URL - modify the output template to use one table - add styles - rename action from handle_post to urllist to reflect its use - use a property to determine the order of url sections - use a list with a type to aggregate the urlbuilder results - use textilize to display labels
This commit is contained in:
parent
9c641cb79c
commit
709f2067cd
7 changed files with 163 additions and 41 deletions
|
@ -1,4 +1,7 @@
|
|||
#
|
||||
# Configuration for DDPortfolio service
|
||||
# Copyright (c) 2009 Jan Dittberner <jan@dittberner.info>
|
||||
#
|
||||
# This file is part of DDPortfolio service.
|
||||
#
|
||||
# DDPortfolio service is free software: you can redistribute it and/or
|
||||
|
@ -17,6 +20,8 @@
|
|||
#
|
||||
[DEFAULT]
|
||||
keyring.dir=/usr/share/keyrings
|
||||
urlbuilder.sections=overview,bugs,build,qa,upload,lists,files,membership,
|
||||
miscellaneous
|
||||
|
||||
[overview]
|
||||
urls=ddpo,alladdresses
|
||||
|
@ -55,8 +60,9 @@ adolists.pattern=http://www.google.com/search?q=site%%3Alists.alioth.debian.org+
|
|||
gmane.pattern=http://search.gmane.org/?email=%(name)s&group=gmane.linux.debian.*
|
||||
|
||||
[files]
|
||||
urls=people,alioth
|
||||
urls=people,oldpeople,alioth
|
||||
people.pattern=http://people.debian.org/~%(username)s/
|
||||
oldpeople.pattern=http://oldpeople.debian.org/~%(username)s/
|
||||
alioth.pattern=http://alioth.debian.org/~%(username)s/
|
||||
|
||||
[membership]
|
||||
|
|
|
@ -31,6 +31,7 @@ import pkg_resources
|
|||
from ddportfolioservice.model import keyfinder
|
||||
from urllib import quote_plus
|
||||
|
||||
|
||||
my_config = ConfigParser.ConfigParser()
|
||||
my_config.readfp(pkg_resources.resource_stream(__name__, 'ddportfolio.ini'))
|
||||
|
||||
|
@ -38,23 +39,24 @@ my_config.readfp(pkg_resources.resource_stream(__name__, 'ddportfolio.ini'))
|
|||
def build_urls(fields):
|
||||
"""Build personalized URLs using the developer information in
|
||||
fields."""
|
||||
data = {}
|
||||
errors = {}
|
||||
data = []
|
||||
qfields = dict([(key, quote_plus(fields[key].encode('utf8'))) \
|
||||
for key in fields])
|
||||
fpr = keyfinder.getFingerprintByEmail(fields['email'].encode('utf8'))
|
||||
if fpr:
|
||||
qfields['gpgfp'] = fpr[0]
|
||||
for section in my_config.sections():
|
||||
for section in [section.strip() for section in \
|
||||
my_config.get('DEFAULT',
|
||||
'urlbuilder.sections').split(',')]:
|
||||
data.append(['section', section])
|
||||
if my_config.has_option(section, 'urls'):
|
||||
for url in my_config.get(section, 'urls').split(','):
|
||||
if my_config.has_option(section, url + '.pattern'):
|
||||
try:
|
||||
data[section + '.' + url] = \
|
||||
my_config.get(section, url + '.pattern',
|
||||
False, qfields)
|
||||
data.append(
|
||||
['url', section, url,
|
||||
my_config.get(section, url + '.pattern',
|
||||
False, qfields)])
|
||||
except Exception, e:
|
||||
errors['%s.%s.pattern' % (section, url)] = \
|
||||
[my_config.get(section, '%s.pattern' % url,
|
||||
True), str(e)]
|
||||
return {'data' : data, 'errors' : errors}
|
||||
data.append(['error', section, url, str(e)])
|
||||
return data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue