|
|
|
@ -3,7 +3,7 @@
|
|
|
|
|
#
|
|
|
|
|
# Debian Member Portfolio Service views
|
|
|
|
|
#
|
|
|
|
|
# Copyright © 2015-2022 Jan Dittberner <jan@dittberner.info>
|
|
|
|
|
# Copyright © 2015-2023 Jan Dittberner <jan@dittberner.info>
|
|
|
|
|
#
|
|
|
|
|
# This file is part of the Debian Member Portfolio Service.
|
|
|
|
|
#
|
|
|
|
@ -23,11 +23,13 @@
|
|
|
|
|
import json
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
|
|
from config import LANGUAGES
|
|
|
|
|
from debianmemberportfolio import app, babel
|
|
|
|
|
from flask import g, make_response, request, render_template, abort
|
|
|
|
|
from flask import abort, g, make_response, render_template, request
|
|
|
|
|
|
|
|
|
|
# noinspection PyPep8Naming
|
|
|
|
|
from flask_babel import lazy_gettext as N_
|
|
|
|
|
from config import LANGUAGES
|
|
|
|
|
|
|
|
|
|
from .forms import DeveloperData, DeveloperDataRequest
|
|
|
|
|
from .model import dddatabuilder
|
|
|
|
|
from .model.urlbuilder import build_urls
|
|
|
|
@ -36,88 +38,93 @@ log = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
#: This dictionary defines groups of labeled portfolio items.
|
|
|
|
|
_LABELS = {
|
|
|
|
|
'overview': {
|
|
|
|
|
'label': N_('Overview'),
|
|
|
|
|
'ddpo': N_("Debian Member's Package Overview"),
|
|
|
|
|
'alladdresses': N_("""Debian Member's Package Overview
|
|
|
|
|
... showing all email addresses"""),
|
|
|
|
|
"overview": {
|
|
|
|
|
"label": N_("Overview"),
|
|
|
|
|
"ddpo": N_("Debian Member's Package Overview"),
|
|
|
|
|
"alladdresses": N_(
|
|
|
|
|
"""Debian Member's Package Overview
|
|
|
|
|
... showing all email addresses"""
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
'bugs': {
|
|
|
|
|
'label': N_('Bugs'),
|
|
|
|
|
'received': N_('''bugs received
|
|
|
|
|
"bugs": {
|
|
|
|
|
"label": N_("Bugs"),
|
|
|
|
|
"received": N_(
|
|
|
|
|
"""bugs received
|
|
|
|
|
(note: co-maintainers not listed, see \
|
|
|
|
|
<a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?\
|
|
|
|
|
bug=430986">#430986</a>)'''),
|
|
|
|
|
'reported': N_('bugs reported'),
|
|
|
|
|
'usertags': N_('user tags'),
|
|
|
|
|
'wnpp': N_('<a href="https://wiki.debian.org/WNPP">WNPP</a>'),
|
|
|
|
|
'correspondent': N_('correspondent for bugs'),
|
|
|
|
|
'graph': N_('one year open bug history graph'),
|
|
|
|
|
bug=430986">#430986</a>)"""
|
|
|
|
|
),
|
|
|
|
|
"reported": N_("bugs reported"),
|
|
|
|
|
"usertags": N_("user tags"),
|
|
|
|
|
"wnpp": N_('<a href="https://wiki.debian.org/WNPP">WNPP</a>'),
|
|
|
|
|
"correspondent": N_("correspondent for bugs"),
|
|
|
|
|
"graph": N_("one year open bug history graph"),
|
|
|
|
|
},
|
|
|
|
|
'build': {
|
|
|
|
|
'label': N_('Build'),
|
|
|
|
|
'buildd': N_('buildd.d.o'),
|
|
|
|
|
'igloo': N_('igloo'),
|
|
|
|
|
"build": {
|
|
|
|
|
"label": N_("Build"),
|
|
|
|
|
"buildd": N_("buildd.d.o"),
|
|
|
|
|
"igloo": N_("igloo"),
|
|
|
|
|
},
|
|
|
|
|
'qa': {
|
|
|
|
|
'label': N_('Quality Assurance'),
|
|
|
|
|
'dmd': N_('maintainer dashboard'),
|
|
|
|
|
'lintian': N_('lintian reports'),
|
|
|
|
|
'lintianfull': N_('full lintian reports (i.e. including \
|
|
|
|
|
"info"-level messages)'),
|
|
|
|
|
'piuparts': N_('piuparts'),
|
|
|
|
|
'janitor': N_('Debian Janitor'),
|
|
|
|
|
"qa": {
|
|
|
|
|
"label": N_("Quality Assurance"),
|
|
|
|
|
"dmd": N_("maintainer dashboard"),
|
|
|
|
|
"lintian": N_("lintian reports"),
|
|
|
|
|
"lintianfull": N_(
|
|
|
|
|
'full lintian reports (i.e. including \
|
|
|
|
|
"info"-level messages)'
|
|
|
|
|
),
|
|
|
|
|
"piuparts": N_("piuparts"),
|
|
|
|
|
"janitor": N_("Debian Janitor"),
|
|
|
|
|
},
|
|
|
|
|
'lists': {
|
|
|
|
|
'label': N_('Mailing Lists'),
|
|
|
|
|
'dolists': N_('lists.d.o'),
|
|
|
|
|
'adolists': N_('lists.a.d.o'),
|
|
|
|
|
"lists": {
|
|
|
|
|
"label": N_("Mailing Lists"),
|
|
|
|
|
"dolists": N_("lists.d.o"),
|
|
|
|
|
"adolists": N_("lists.a.d.o"),
|
|
|
|
|
},
|
|
|
|
|
'files': {
|
|
|
|
|
'label': N_('Files'),
|
|
|
|
|
'people': N_('people.d.o'),
|
|
|
|
|
'oldpeople': N_('oldpeople'),
|
|
|
|
|
"files": {
|
|
|
|
|
"label": N_("Files"),
|
|
|
|
|
"people": N_("people.d.o"),
|
|
|
|
|
"oldpeople": N_("oldpeople"),
|
|
|
|
|
},
|
|
|
|
|
'membership': {
|
|
|
|
|
'label': N_('Membership'),
|
|
|
|
|
'nm': N_('NM'),
|
|
|
|
|
'dbfinger': N_('DB information via finger'),
|
|
|
|
|
'db': N_('DB information via HTTP'),
|
|
|
|
|
'salsa': N_('Salsa'),
|
|
|
|
|
'wiki': N_('Wiki'),
|
|
|
|
|
'forum': N_('Forum'),
|
|
|
|
|
"membership": {
|
|
|
|
|
"label": N_("Membership"),
|
|
|
|
|
"nm": N_("NM"),
|
|
|
|
|
"dbfinger": N_("DB information via finger"),
|
|
|
|
|
"db": N_("DB information via HTTP"),
|
|
|
|
|
"salsa": N_("Salsa"),
|
|
|
|
|
"wiki": N_("Wiki"),
|
|
|
|
|
"forum": N_("Forum"),
|
|
|
|
|
},
|
|
|
|
|
'miscellaneous': {
|
|
|
|
|
'label': N_('Miscellaneous'),
|
|
|
|
|
'debtags': N_('debtags'),
|
|
|
|
|
'planetname': N_('Planet Debian (name)'),
|
|
|
|
|
'planetuser': N_('Planet Debian (username)'),
|
|
|
|
|
'links': N_('links'),
|
|
|
|
|
'website': N_('Debian website'),
|
|
|
|
|
'search': N_('Debian search'),
|
|
|
|
|
'gpgfinger': N_('OpenPGP public key via finger'),
|
|
|
|
|
'gpgweb': N_('OpenPGP public key via HTTP'),
|
|
|
|
|
'nm': N_('NM, AM participation'),
|
|
|
|
|
'contrib': N_('Contribution information'),
|
|
|
|
|
'repology': N_('Repology information'),
|
|
|
|
|
"miscellaneous": {
|
|
|
|
|
"label": N_("Miscellaneous"),
|
|
|
|
|
"debtags": N_("debtags"),
|
|
|
|
|
"planetname": N_("Planet Debian (name)"),
|
|
|
|
|
"planetuser": N_("Planet Debian (username)"),
|
|
|
|
|
"links": N_("links"),
|
|
|
|
|
"website": N_("Debian website"),
|
|
|
|
|
"search": N_("Debian search"),
|
|
|
|
|
"gpgfinger": N_("OpenPGP public key via finger"),
|
|
|
|
|
"gpgweb": N_("OpenPGP public key via HTTP"),
|
|
|
|
|
"nm": N_("NM, AM participation"),
|
|
|
|
|
"contrib": N_("Contribution information"),
|
|
|
|
|
"repology": N_("Repology information"),
|
|
|
|
|
},
|
|
|
|
|
'ssh': {
|
|
|
|
|
'label': N_('Information reachable via ssh (for Debian Members)'),
|
|
|
|
|
'owndndoms': N_('owned debian.net domains'),
|
|
|
|
|
'miainfo': N_('<a href="https://wiki.debian.org/qa.debian.org/'
|
|
|
|
|
'MIATeam">MIA</a> database information'),
|
|
|
|
|
'groupinfo': N_('Group membership information'),
|
|
|
|
|
"ssh": {
|
|
|
|
|
"label": N_("Information reachable via ssh (for Debian Members)"),
|
|
|
|
|
"owndndoms": N_("owned debian.net domains"),
|
|
|
|
|
"miainfo": N_(
|
|
|
|
|
'<a href="https://wiki.debian.org/qa.debian.org/'
|
|
|
|
|
'MIATeam">MIA</a> database information'
|
|
|
|
|
),
|
|
|
|
|
"groupinfo": N_("Group membership information"),
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#: list of field name tuples for Debian Maintainers
|
|
|
|
|
DM_TUPLES = (('name', 'name'),
|
|
|
|
|
('openpgpfp', 'openpgpfp'),
|
|
|
|
|
('nonddemail', 'email'))
|
|
|
|
|
DM_TUPLES = (("name", "name"), ("openpgpfp", "openpgpfp"), ("nonddemail", "email"))
|
|
|
|
|
|
|
|
|
|
#: list of field name tuples for Debian Developers
|
|
|
|
|
DD_TUPLES = (('username', 'username'),
|
|
|
|
|
('salsausername', 'username'))
|
|
|
|
|
DD_TUPLES = (("username", "username"), ("salsausername", "username"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _get_label(section, url=None):
|
|
|
|
@ -125,8 +132,8 @@ def _get_label(section, url=None):
|
|
|
|
|
if url:
|
|
|
|
|
if url in _LABELS[section]:
|
|
|
|
|
return _LABELS[section][url]
|
|
|
|
|
elif 'label' in _LABELS[section]:
|
|
|
|
|
return _LABELS[section]['label']
|
|
|
|
|
elif "label" in _LABELS[section]:
|
|
|
|
|
return _LABELS[section]["label"]
|
|
|
|
|
if url:
|
|
|
|
|
return "%s.%s" % (section, url)
|
|
|
|
|
return section
|
|
|
|
@ -142,70 +149,75 @@ def before_request():
|
|
|
|
|
g.locale = get_locale()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/')
|
|
|
|
|
@app.route("/")
|
|
|
|
|
def index():
|
|
|
|
|
form = DeveloperData()
|
|
|
|
|
return render_template('showform.html', form=form)
|
|
|
|
|
return render_template("showform.html", form=form)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/result')
|
|
|
|
|
@app.route("/result")
|
|
|
|
|
def urllist():
|
|
|
|
|
form = DeveloperData(request.values)
|
|
|
|
|
if form.validate():
|
|
|
|
|
fields = dddatabuilder.build_data(form.data['email'])
|
|
|
|
|
fields = dddatabuilder.build_data(form.data["email"])
|
|
|
|
|
|
|
|
|
|
form_data = form.data.copy()
|
|
|
|
|
|
|
|
|
|
if fields['type'] in (dddatabuilder.TYPE_DD, dddatabuilder.TYPE_DM):
|
|
|
|
|
if fields["type"] in (dddatabuilder.TYPE_DD, dddatabuilder.TYPE_DM):
|
|
|
|
|
for dmtuple in DM_TUPLES:
|
|
|
|
|
if not form_data[dmtuple[0]]:
|
|
|
|
|
form_data[dmtuple[0]] = fields[dmtuple[1]]
|
|
|
|
|
if fields['type'] == dddatabuilder.TYPE_DD:
|
|
|
|
|
if fields["type"] == dddatabuilder.TYPE_DD:
|
|
|
|
|
for ddtuple in DD_TUPLES:
|
|
|
|
|
if not form_data[ddtuple[0]]:
|
|
|
|
|
form_data[ddtuple[0]] = fields[ddtuple[1]]
|
|
|
|
|
if not form_data['wikihomepage']:
|
|
|
|
|
log.debug('generate wikihomepage from name')
|
|
|
|
|
form_data['wikihomepage'] = "".join([
|
|
|
|
|
part.capitalize() for part in form_data['name'].split()
|
|
|
|
|
])
|
|
|
|
|
if not form_data["wikihomepage"] and form_data["name"]:
|
|
|
|
|
log.debug("generate wikihomepage from name")
|
|
|
|
|
form_data["wikihomepage"] = "".join(
|
|
|
|
|
[part.capitalize() for part in form_data["name"].split()]
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
data = build_urls(form_data)
|
|
|
|
|
|
|
|
|
|
if form_data['mode'] == 'json':
|
|
|
|
|
response = make_response(json.dumps(dict(
|
|
|
|
|
[("{}.{}".format(entry[1], entry[2].name), entry[3])
|
|
|
|
|
for entry in data if entry[0] == 'url'])))
|
|
|
|
|
response.headers['Content-Type'] = 'application/json'
|
|
|
|
|
if form_data["mode"] == "json":
|
|
|
|
|
response = make_response(
|
|
|
|
|
json.dumps(
|
|
|
|
|
dict(
|
|
|
|
|
[
|
|
|
|
|
("{}.{}".format(entry[1], entry[2].name), entry[3])
|
|
|
|
|
for entry in data
|
|
|
|
|
if entry[0] == "url"
|
|
|
|
|
]
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
response.headers["Content-Type"] = "application/json"
|
|
|
|
|
return response
|
|
|
|
|
|
|
|
|
|
for entry in data:
|
|
|
|
|
if entry[0] in ('url', 'error'):
|
|
|
|
|
if entry[0] in ("url", "error"):
|
|
|
|
|
entry.append(_get_label(entry[1], entry[2].name))
|
|
|
|
|
elif entry[0] == 'section':
|
|
|
|
|
elif entry[0] == "section":
|
|
|
|
|
entry.append(_get_label(entry[1]))
|
|
|
|
|
|
|
|
|
|
return render_template('showurls.html', urldata=data)
|
|
|
|
|
return render_template('showform.html', form=form)
|
|
|
|
|
return render_template("showurls.html", urldata=data)
|
|
|
|
|
return render_template("showform.html", form=form)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/htmlformhelper.js')
|
|
|
|
|
@app.route("/htmlformhelper.js")
|
|
|
|
|
def formhelper_js():
|
|
|
|
|
response = make_response(render_template('showformscript.js'))
|
|
|
|
|
response.headers['Content-Type'] = 'text/javascript; charset=utf-8'
|
|
|
|
|
response = make_response(render_template("showformscript.js"))
|
|
|
|
|
response.headers["Content-Type"] = "text/javascript; charset=utf-8"
|
|
|
|
|
return response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/showformscripts/fetchdddata/')
|
|
|
|
|
@app.route("/showformscripts/fetchdddata/")
|
|
|
|
|
def fetchdddata():
|
|
|
|
|
form = DeveloperDataRequest(request.values)
|
|
|
|
|
if form.validate():
|
|
|
|
|
fields = dddatabuilder.build_data(form.data['email'])
|
|
|
|
|
fields = dddatabuilder.build_data(form.data["email"])
|
|
|
|
|
log.debug(fields)
|
|
|
|
|
response = make_response(json.dumps(fields))
|
|
|
|
|
response.headers['Content-Type'] = 'application/json'
|
|
|
|
|
response.headers["Content-Type"] = "application/json"
|
|
|
|
|
return response
|
|
|
|
|
abort(
|
|
|
|
|
400,
|
|
|
|
|
"\n".join(["%s: %s" % (key, form.errors[key]) for key in form.errors])
|
|
|
|
|
)
|
|
|
|
|
abort(400, "\n".join(["%s: %s" % (key, form.errors[key]) for key in form.errors]))
|
|
|
|
|