add support for non URL-Information

This commit is contained in:
Jan Dittberner 2010-06-04 00:29:28 +02:00
commit 770a533e40
8 changed files with 113 additions and 50 deletions

View file

@ -3,3 +3,5 @@
* add support for extra parameters forumsid and wikihomepage * add support for extra parameters forumsid and wikihomepage
* add new patterns wiki and forum to section membership * add new patterns wiki and forum to section membership
* update copyright information * update copyright information
* add support for non-URL type information
* add ssh commands for MIA, owned debian.net-Domains and group membership

View file

@ -100,6 +100,12 @@ developer name on all bug logs)'),
'website' : N_('Debian website'), 'website' : N_('Debian website'),
'search' : N_('Debian search'), 'search' : N_('Debian search'),
}, },
'ssh' : {
'label' : N_('Information reachable via ssh (for DDs)'),
'owndndoms' : N_('owned debian.net domains'),
'miainfo' : N_('<a href="http://wiki.debian.org/qa.debian.org/MIATeam">MIA</a> database information'),
'groupinfo' : N_('Group membership information'),
},
'ubuntu' : { 'ubuntu' : {
'label' : N_('Ubuntu'), 'label' : N_('Ubuntu'),
'ubuntudiff' : N_('Available patches from Ubuntu'), 'ubuntudiff' : N_('Available patches from Ubuntu'),
@ -165,11 +171,11 @@ developer name on all bug logs)'),
response.headers['Content-Type'] = 'text/javascript' response.headers['Content-Type'] = 'text/javascript'
return simplejson.dumps( return simplejson.dumps(
dict([("%s.%s" % \ dict([("%s.%s" % \
(entry[1], entry[2]), entry[3]) \ (entry[1], entry[2].name), entry[3]) \
for entry in data if entry[0] == 'url'])) for entry in data if entry[0] == 'url']))
for entry in data: for entry in data:
if entry[0] in ('url', 'error'): if entry[0] in ('url', 'error'):
entry.append(_(self._get_label(entry[1], entry[2]))) entry.append(_(self._get_label(entry[1], entry[2].name)))
elif entry[0] == 'section': elif entry[0] == 'section':
entry.append(_(self._get_label(entry[1]))) entry.append(_(self._get_label(entry[1])))
c.urldata = data c.urldata = data

View file

@ -9,7 +9,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ddportfolioservice 0.1\n" "Project-Id-Version: ddportfolioservice 0.1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2010-06-03 23:32+0200\n" "POT-Creation-Date: 2010-06-04 00:25+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -191,10 +191,28 @@ msgid "Debian search"
msgstr "" msgstr ""
#: ddportfolioservice/controllers/ddportfolio.py:104 #: ddportfolioservice/controllers/ddportfolio.py:104
msgid "Ubuntu" msgid "Information reachable via ssh (for DDs)"
msgstr "" msgstr ""
#: ddportfolioservice/controllers/ddportfolio.py:105 #: ddportfolioservice/controllers/ddportfolio.py:105
msgid "owned debian.net domains"
msgstr ""
#: ddportfolioservice/controllers/ddportfolio.py:106
msgid ""
"<a href=\"http://wiki.debian.org/qa.debian.org/MIATeam\">MIA</a> database "
"information"
msgstr ""
#: ddportfolioservice/controllers/ddportfolio.py:107
msgid "Group membership information"
msgstr ""
#: ddportfolioservice/controllers/ddportfolio.py:110
msgid "Ubuntu"
msgstr ""
#: ddportfolioservice/controllers/ddportfolio.py:111
msgid "Available patches from Ubuntu" msgid "Available patches from Ubuntu"
msgstr "" msgstr ""
@ -222,8 +240,8 @@ msgstr ""
msgid "Alioth user name" msgid "Alioth user name"
msgstr "" msgstr ""
#: ddportfolioservice/model/urlbuilder.py:86 #: ddportfolioservice/model/urlbuilder.py:95
#: ddportfolioservice/model/urlbuilder.py:90 #: ddportfolioservice/model/urlbuilder.py:99
#, python-format #, python-format
msgid "Missing input: %s" msgid "Missing input: %s"
msgstr "" msgstr ""
@ -269,7 +287,7 @@ msgid "Enter your personal information"
msgstr "" msgstr ""
#: ddportfolioservice/templates/showform.mako:30 #: ddportfolioservice/templates/showform.mako:30
#: ddportfolioservice/templates/showurls.mako:27 #: ddportfolioservice/templates/showurls.mako:28
msgid "Debian Developer Portfolio" msgid "Debian Developer Portfolio"
msgstr "" msgstr ""
@ -313,23 +331,23 @@ msgstr ""
msgid "Build DD Portfolio URLs" msgid "Build DD Portfolio URLs"
msgstr "" msgstr ""
#: ddportfolioservice/templates/showurls.mako:23 #: ddportfolioservice/templates/showurls.mako:24
msgid "Your personal links" msgid "Your personal links"
msgstr "" msgstr ""
#: ddportfolioservice/templates/showurls.mako:30 #: ddportfolioservice/templates/showurls.mako:31
msgid "Usage" msgid "Usage"
msgstr "" msgstr ""
#: ddportfolioservice/templates/showurls.mako:30 #: ddportfolioservice/templates/showurls.mako:31
msgid "URL" msgid "URL"
msgstr "" msgstr ""
#: ddportfolioservice/templates/showurls.mako:40 #: ddportfolioservice/templates/showurls.mako:41
msgid "Error during URL creation:" msgid "Error during URL creation:"
msgstr "" msgstr ""
#: ddportfolioservice/templates/showurls.mako:61 #: ddportfolioservice/templates/showurls.mako:68
msgid "Restart" msgid "Restart"
msgstr "" msgstr ""

View file

@ -9,9 +9,9 @@ msgstr ""
"Project-Id-Version: ddportfolioservice 0.1\n" "Project-Id-Version: ddportfolioservice 0.1\n"
"Report-Msgid-Bugs-To: jan@dittberner.info\n" "Report-Msgid-Bugs-To: jan@dittberner.info\n"
"POT-Creation-Date: 2009-01-20 23:13+0100\n" "POT-Creation-Date: 2009-01-20 23:13+0100\n"
"PO-Revision-Date: 2010-06-03 23:31+0200\n" "PO-Revision-Date: 2010-06-04 00:27+0200\n"
"Last-Translator: Jan Dittberner <jan@dittberner.info>\n" "Last-Translator: Jan Dittberner <jan@dittberner.info>\n"
"Language-Team: de <LL@li.org>\n" "Language-Team: de <de@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
@ -203,10 +203,29 @@ msgid "Debian search"
msgstr "Debian-Suche" msgstr "Debian-Suche"
#: ddportfolioservice/controllers/ddportfolio.py:104 #: ddportfolioservice/controllers/ddportfolio.py:104
msgid "Information reachable via ssh (for DDs)"
msgstr "Per ssh erreichbare Informationen (für DDs)"
#: ddportfolioservice/controllers/ddportfolio.py:105
msgid "owned debian.net domains"
msgstr "Besitz von debian.net-Domains"
#: ddportfolioservice/controllers/ddportfolio.py:106
msgid ""
"<a href=\"http://wiki.debian.org/qa.debian.org/MIATeam\">MIA</a> database"
" information"
msgstr "Informationen in der <a href=\"http://wiki.debian.org/qa.debian.org/MIATeam\">MIA</a>-Datenbank"
#: ddportfolioservice/controllers/ddportfolio.py:107
#| msgid "Enter your personal information"
msgid "Group membership information"
msgstr "Information über Gruppenmitgliedschaften"
#: ddportfolioservice/controllers/ddportfolio.py:110
msgid "Ubuntu" msgid "Ubuntu"
msgstr "Ubuntu" msgstr "Ubuntu"
#: ddportfolioservice/controllers/ddportfolio.py:105 #: ddportfolioservice/controllers/ddportfolio.py:111
msgid "Available patches from Ubuntu" msgid "Available patches from Ubuntu"
msgstr "Verfügbare Patches aus Ubuntu" msgstr "Verfügbare Patches aus Ubuntu"
@ -234,8 +253,8 @@ msgstr "Nicht-DD E-Mailadresse:"
msgid "Alioth user name" msgid "Alioth user name"
msgstr "Alioth-Benutzername" msgstr "Alioth-Benutzername"
#: ddportfolioservice/model/urlbuilder.py:86 #: ddportfolioservice/model/urlbuilder.py:95
#: ddportfolioservice/model/urlbuilder.py:90 #: ddportfolioservice/model/urlbuilder.py:99
#, python-format #, python-format
msgid "Missing input: %s" msgid "Missing input: %s"
msgstr "Fehlende Eingabe: %s" msgstr "Fehlende Eingabe: %s"
@ -293,7 +312,7 @@ msgid "Enter your personal information"
msgstr "Eingabe der persönlichen Informationen" msgstr "Eingabe der persönlichen Informationen"
#: ddportfolioservice/templates/showform.mako:30 #: ddportfolioservice/templates/showform.mako:30
#: ddportfolioservice/templates/showurls.mako:27 #: ddportfolioservice/templates/showurls.mako:28
msgid "Debian Developer Portfolio" msgid "Debian Developer Portfolio"
msgstr "Debian-Entwicklerportfolio" msgstr "Debian-Entwicklerportfolio"
@ -337,23 +356,23 @@ msgstr "JSON"
msgid "Build DD Portfolio URLs" msgid "Build DD Portfolio URLs"
msgstr "Debian-Entwicklerportfolio-URLs bauen" msgstr "Debian-Entwicklerportfolio-URLs bauen"
#: ddportfolioservice/templates/showurls.mako:23 #: ddportfolioservice/templates/showurls.mako:24
msgid "Your personal links" msgid "Your personal links"
msgstr "Ihre personalisierten Links" msgstr "Ihre personalisierten Links"
#: ddportfolioservice/templates/showurls.mako:30 #: ddportfolioservice/templates/showurls.mako:31
msgid "Usage" msgid "Usage"
msgstr "Verwendung" msgstr "Verwendung"
#: ddportfolioservice/templates/showurls.mako:30 #: ddportfolioservice/templates/showurls.mako:31
msgid "URL" msgid "URL"
msgstr "URL" msgstr "URL"
#: ddportfolioservice/templates/showurls.mako:40 #: ddportfolioservice/templates/showurls.mako:41
msgid "Error during URL creation:" msgid "Error during URL creation:"
msgstr "Fehler bei der URL-Erzeugung:" msgstr "Fehler bei der URL-Erzeugung:"
#: ddportfolioservice/templates/showurls.mako:61 #: ddportfolioservice/templates/showurls.mako:68
msgid "Restart" msgid "Restart"
msgstr "Neu beginnen" msgstr "Neu beginnen"

View file

@ -21,7 +21,7 @@
[DEFAULT] [DEFAULT]
keyring.dir=~/debian/keyring.debian.org/keyrings keyring.dir=~/debian/keyring.debian.org/keyrings
urlbuilder.sections=overview,bugs,build,qa,upload,lists,files,membership, urlbuilder.sections=overview,bugs,build,qa,upload,lists,files,membership,
miscellaneous,ubuntu miscellaneous,ssh,ubuntu
[overview] [overview]
urls=ddpo,alladdresses urls=ddpo,alladdresses
@ -86,17 +86,19 @@ debtags.pattern=http://debtags.alioth.debian.org/todo.html?maint=%(email)s
links.pattern=http://www.google.com/search?hl=en&lr=&q=site%%3Adebian.org+%%22%(name)s%%22+-site%%3Anm.debian.org+-site%%3Alintian.debian.org+-site%%3Abugs.debian.org+-site%%3Alists.debian.org+-site%%3Apackages.debian.org+-site%%3Alists.alioth.debian.org+-site%%3Aftp.debian.org++-site%%3Apackages.qa.debian.org++-site%%3Aftp*.*.debian.org+-inurl%%3Adebian.org%%2Fdevel%%2Fpeople.+-inurl%%3Aindices%%2FMaintainers+-inurl%%3Adebian.org%%2Fdebian%%2Fproject++-inurl%%3A%%2Fdists%%2F&btnG=Search links.pattern=http://www.google.com/search?hl=en&lr=&q=site%%3Adebian.org+%%22%(name)s%%22+-site%%3Anm.debian.org+-site%%3Alintian.debian.org+-site%%3Abugs.debian.org+-site%%3Alists.debian.org+-site%%3Apackages.debian.org+-site%%3Alists.alioth.debian.org+-site%%3Aftp.debian.org++-site%%3Apackages.qa.debian.org++-site%%3Aftp*.*.debian.org+-inurl%%3Adebian.org%%2Fdevel%%2Fpeople.+-inurl%%3Aindices%%2FMaintainers+-inurl%%3Adebian.org%%2Fdebian%%2Fproject++-inurl%%3A%%2Fdists%%2F&btnG=Search
website.pattern=http://www.google.com/search?q=site:www.debian.org+%(name)s website.pattern=http://www.google.com/search?q=site:www.debian.org+%(name)s
search.pattern=http://search.debian.org/?q=%%22%(name)s%%22 search.pattern=http://search.debian.org/?q=%%22%(name)s%%22
[ssh]
# SSH functions # SSH functions
# urls=owndndoms,miainfo,groupinfo
# owned *.debian.net domains # owned *.debian.net domains
# ssh merkel.debian.org ldapsearch -u -x -H ldap://db.debian.org -b dc=debian,dc=org \ owndndoms.pattern=ssh merkel.debian.org ldapsearch -u -x -H ldap://db.debian.org -b dc=debian,dc=org uid=%(username)s dnsZoneEntry
# uid=%(username)s dnsZoneEntry owndndoms.type=ssh
#
# MIA information # MIA information
# 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 %(username)s
# miainfo.type=ssh
# Group information # Group information
# ssh merkel.debian.org id %(username)s groupinfo.pattern=ssh merkel.debian.org id %(username)s
groupinfo.type=ssh
[ubuntu] [ubuntu]
urls=ubuntudiff urls=ubuntudiff

View file

@ -46,6 +46,17 @@ _FIELDNAMES_MAP = {
} }
class DDPortfolioEntry(object):
def __init__(self, config, section, key):
self.name = key
self.optional = config.has_option(section, key + '.optional') and \
config.getboolean(section, key + '.optional') or False
if config.has_option(section, key + '.type'):
self.type = config.get(section, key + '.type')
else:
self.type = 'url'
def build_urls(fields): def build_urls(fields):
"""Build personalized URLs using the developer information in """Build personalized URLs using the developer information in
fields.""" fields."""
@ -70,22 +81,20 @@ def build_urls(fields):
'urlbuilder.sections').split(',')]: 'urlbuilder.sections').split(',')]:
data.append(['section', section]) data.append(['section', section])
if my_config.has_option(section, 'urls'): if my_config.has_option(section, 'urls'):
for url in my_config.get(section, 'urls').split(','): for entry in ([DDPortfolioEntry(my_config, section, url) for url in \
if my_config.has_option(section, url + '.pattern'): my_config.get(section, 'urls').split(',')]):
optional = my_config.has_option(section, url + '.optional') \
and my_config.getboolean(section, url + '.optional') or False
try: try:
data.append( data.append(
['url', section, url, ['url', section, entry,
my_config.get(section, url + '.pattern', my_config.get(section, entry.name + '.pattern',
False, qfields)]) False, qfields)])
except InterpolationMissingOptionError, e: except InterpolationMissingOptionError, e:
if not optional: if not entry.optional:
if e.reference in _FIELDNAMES_MAP: if e.reference in _FIELDNAMES_MAP:
data.append(['error', section, url, data.append(['error', section, entry,
_('Missing input: %s') % \ _('Missing input: %s') % \
_(_FIELDNAMES_MAP[e.reference])]) _(_FIELDNAMES_MAP[e.reference])])
else: else:
data.append(['error', section, url, data.append(['error', section, entry,
_('Missing input: %s') % e.reference]) _('Missing input: %s') % e.reference])
return data return data

View file

@ -1,7 +1,8 @@
## -*- coding: utf-8 -*- \
<%inherit file="base.mako" /> <%inherit file="base.mako" />
<%doc> <%doc>
Template for the url output page. Template for the url output page.
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.
@ -44,7 +45,13 @@ License along with this program. If not, see
% else: % else:
<tr class="url ${urlclass}"> <tr class="url ${urlclass}">
<td>${h.textile(row[4])}</td> <td>${h.textile(row[4])}</td>
<td>${h.link_to(h.truncate(row[3], length=120), row[3])}</td> <td>
% if row[2].type == 'url':
${h.link_to(h.truncate(row[3], length=120), row[3])}
% else:
<tt>${row[3]}</tt>
% endif
</td>
</tr> </tr>
<% <%
if urlclass == 'odd': if urlclass == 'odd':