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
|
@ -30,6 +30,82 @@ from ddportfolioservice.model.urlbuilder import *
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
class DdportfolioController(BaseController):
|
||||
_LABELS = {
|
||||
'overview' : {
|
||||
'label' : N_('Overview'),
|
||||
'ddpo' : N_("Debian Developer's Package Overview"),
|
||||
'alladdresses' : N_("""Debian Developer's Package Overview
|
||||
... showing all email addresses"""),
|
||||
},
|
||||
'bugs' : {
|
||||
'label' : N_('Bugs'),
|
||||
'received' : N_('''bugs received
|
||||
(note: co-maintainers not listed, see \
|
||||
<a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?\
|
||||
bug=430986">#430986</a>)'''),
|
||||
'reported' : N_('bugs reported'),
|
||||
'bugstats' : N_('bugstats AKA <em>karma</em>'),
|
||||
'usertags' : N_('user tags'),
|
||||
'searchall' : N_('all messages (i.e., full text search for \
|
||||
developer name on all bug logs)'),
|
||||
'wnpp' : N_('<a href="http://wiki.debian.org/WNPP">WNPP</a>'),
|
||||
},
|
||||
'build' : {
|
||||
'label' : N_('Build'),
|
||||
'buildd' : N_('buildd.d.o (note: co-maintainers \
|
||||
<em>not</em> listed)'),
|
||||
'igloo' : N_('igloo'),
|
||||
'svnbuildstat' : N_('svnbuildstat'),
|
||||
},
|
||||
'qa' : {
|
||||
'label' : N_('Quality Assurance'),
|
||||
'lintian' : N_('lintian reports'),
|
||||
'lintianfull' : N_('full lintian reports (i.e. including \
|
||||
"info"-level messages)'),
|
||||
'dehs' : N_('DEHS (Debian External Health Status)'),
|
||||
},
|
||||
'upload' : {
|
||||
'label' : N_('Upload'),
|
||||
'keylog' : N_('''keylog (per-key upload list)
|
||||
(note: uses key fingerprint)'''),
|
||||
},
|
||||
'lists' : {
|
||||
'label' : N_('Mailing Lists'),
|
||||
'dolists' : N_('lists.d.o'),
|
||||
'adolists' : N_('lists.a.d.o'),
|
||||
'gmane' : N_('gmane'),
|
||||
},
|
||||
'files' : {
|
||||
'label' : N_('Files'),
|
||||
'people' : N_('people.d.o'),
|
||||
'oldpeople' : N_('oldpeople'),
|
||||
'alioth' : N_('Alioth'),
|
||||
},
|
||||
'membership' : {
|
||||
'label' : N_('Membership'),
|
||||
'nm' : N_('NM'),
|
||||
'db' : N_('DB'),
|
||||
'alioth' : N_('Alioth'),
|
||||
},
|
||||
'miscellaneous' : {
|
||||
'label' : N_('Miscellaneous'),
|
||||
'debtags' : N_('debtags'),
|
||||
'links' : N_('links'),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def _get_label(self, section, url=None):
|
||||
if section in self._LABELS:
|
||||
if url:
|
||||
if url in self._LABELS[section]:
|
||||
return self._LABELS[section][url]
|
||||
elif 'label' in self._LABELS[section]:
|
||||
return self._LABELS[section]['label']
|
||||
if url:
|
||||
return "%s.%s" % (section, url)
|
||||
return section
|
||||
|
||||
|
||||
def index(self):
|
||||
# Return a rendered template
|
||||
|
@ -37,7 +113,8 @@ class DdportfolioController(BaseController):
|
|||
# or, Return a response
|
||||
return render('/showform.mako')
|
||||
|
||||
def handle_post(self):
|
||||
def urllist(self):
|
||||
"""Handle the actual data."""
|
||||
schema = DeveloperData()
|
||||
try:
|
||||
formencode.api.set_stdtranslation(
|
||||
|
@ -50,6 +127,14 @@ class DdportfolioController(BaseController):
|
|||
data = build_urls(form_result)
|
||||
if 'mode' in request.params and request.params['mode'] == 'json':
|
||||
response.headers['Content-Type'] = 'text/json'
|
||||
return simplejson.dumps(data['data'])
|
||||
return simplejson.dumps(
|
||||
dict([("%s.%s" % \
|
||||
(entry[1], entry[2]), entry[3]) \
|
||||
for entry in data if entry[0] == 'url']))
|
||||
for entry in data:
|
||||
if entry[0] in ('url', 'error'):
|
||||
entry.append(_(self._get_label(entry[1], entry[2])))
|
||||
elif entry[0] == 'section':
|
||||
entry.append(_(self._get_label(entry[1])))
|
||||
c.urldata = data
|
||||
return render('/showurls.mako')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue