PEP-8 compliance

- fix all PEP-8 warnings
- bump copyright years
This commit is contained in:
Jan Dittberner 2012-01-07 01:46:57 +01:00
parent e643987d3d
commit 6224abdf63
16 changed files with 164 additions and 128 deletions

View file

@ -35,91 +35,92 @@ from ddportfolioservice.model import dddatabuilder
log = logging.getLogger(__name__)
class DdportfolioController(BaseController):
_LABELS = {
'overview' : {
'label' : N_('Overview'),
'ddpo' : N_("Debian Member's Package Overview"),
'alladdresses' : N_("""Debian Member's Package Overview
'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="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 \
'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>'),
'correspondent' : N_('correspondent for bugs'),
'graph' : N_('one year open bug history graph'),
'wnpp': N_('<a href="http://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'),
'lintian' : N_('lintian reports'),
'lintianfull' : N_('full lintian reports (i.e. including \
'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)'),
'piuparts' : N_('piuparts'),
'patchtracker' : N_('Debian patch tracking system'),
'dehs': N_('DEHS (Debian External Health Status)'),
'piuparts': N_('piuparts'),
'patchtracker': N_('Debian patch tracking system'),
},
'upload' : {
'label' : N_('Upload'),
'keylog' : N_('''keylog (per-key upload list)
'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'),
'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'),
'files': {
'label': N_('Files'),
'people': N_('people.d.o'),
'oldpeople': N_('oldpeople'),
'alioth': N_('Alioth'),
},
'membership' : {
'label' : N_('Membership'),
'nm' : N_('NM'),
'dbfinger' : N_('DB information via finger'),
'db' : N_('DB information via HTTP'),
'alioth' : N_('Alioth'),
'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'),
'alioth': N_('Alioth'),
'wiki': N_('Wiki'),
'forum': N_('Forum'),
},
'miscellaneous' : {
'label' : N_('Miscellaneous'),
'debtags' : N_('debtags'),
'links' : N_('links'),
'website' : N_('Debian website'),
'search' : N_('Debian search'),
'gpgfinger' : N_('GPG public key via finger'),
'gpgweb' : N_('GPG public key via HTTP'),
'miscellaneous': {
'label': N_('Miscellaneous'),
'debtags': N_('debtags'),
'links': N_('links'),
'website': N_('Debian website'),
'search': N_('Debian search'),
'gpgfinger': N_('GPG public key via finger'),
'gpgweb': N_('GPG public key via HTTP'),
},
'ssh' : {
'label' : N_('Information reachable via ssh (for Debian Members)'),
'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'),
'ssh': {
'label': N_('Information reachable via ssh (for Debian Members)'),
'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' : {
'label' : N_('Ubuntu'),
'ubuntudiff' : N_('Available patches from Ubuntu'),
'ubuntu': {
'label': N_('Ubuntu'),
'ubuntudiff': N_('Available patches from Ubuntu'),
},
}
def _get_label(self, section, url=None):
if section in self._LABELS:
if url:
@ -132,9 +133,9 @@ developer name on all bug logs)'),
return section
def index(self):
# Return a rendered template
# return render('/some/template.mako')
# or, Return a response
"""
Render the input form.
"""
return render('/showform.mako')
def urllist(self):
@ -146,7 +147,7 @@ developer name on all bug logs)'),
languages=[lang[0:2] for lang in request.languages])
form_result = schema.to_python(request.params)
except formencode.validators.Invalid, error:
c.messages = { 'errors' : error.unpack_errors() }
c.messages = {'errors': error.unpack_errors()}
return render('/showform.mako')
fields = dddatabuilder.build_data(form_result['email'])
rp = request.params.copy()
@ -173,7 +174,7 @@ developer name on all bug logs)'),
languages=[lang[0:2] for lang in request.languages])
form_result = schema.to_python(rp)
except formencode.validators.Invalid, error:
c.messages = { 'errors' : error.unpack_errors() }
c.messages = {'errors': error.unpack_errors()}
return render('/showform.mako')
if form_result['wikihomepage'] is None:
log.debug('generate wikihomepage from name')

View file

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
#
# DDPortfolio service ErrorController
# Copyright © 2009, 2010 Jan Dittberner <jan@dittberner.info>
# Copyright © 2009, 2010, 2011, 2012 Jan Dittberner <jan@dittberner.info>
#
# This file is part of DDPortfolio service.
#
@ -30,8 +30,8 @@ from webhelpers.html.builder import literal
from ddportfolioservice.lib.base import BaseController
class ErrorController(BaseController):
class ErrorController(BaseController):
"""Generates error documents as and when they are required.
The ErrorDocuments middleware forwards to ErrorController when error
@ -39,16 +39,17 @@ class ErrorController(BaseController):
This behaviour can be altered by changing the parameters to the
ErrorDocuments middleware in your config/middleware.py file.
"""
def document(self):
"""Render the error document"""
resp = request.environ.get('pylons.original_response')
content = literal(resp.body) or cgi.escape(request.GET.get('message', ''))
content = literal(resp.body) or cgi.escape(
request.GET.get('message', ''))
page = error_document_template % \
dict(prefix=request.environ.get('SCRIPT_NAME', ''),
code=cgi.escape(request.GET.get('code', str(resp.status_int))),
code=cgi.escape(
request.GET.get('code', str(resp.status_int))),
message=content)
return page
@ -61,8 +62,9 @@ class ErrorController(BaseController):
return self._serve_file('/'.join(['media/style', id]))
def _serve_file(self, path):
"""Call Paste's FileApp (a WSGI application) to serve the file
at the specified path
"""
Call Paste's FileApp (a WSGI application) to serve the file at
the specified path
"""
request.environ['PATH_INFO'] = '/%s' % path
return forward(PkgResourcesParser('pylons', 'pylons'))

View file

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
#
# DDPortfolio service ShowformscriptController.
# Copyright © 2009, 2010 Jan Dittberner <jan@dittberner.info>
# Copyright © 2009, 2010, 2011, 2012 Jan Dittberner <jan@dittberner.info>
#
# This file is part of DDPortfolio service.
#
@ -34,6 +34,7 @@ from ddportfolioservice.model import dddatabuilder
log = logging.getLogger(__name__)
class ShowformscriptsController(BaseController):
"""This controller is used to support data entry in showform.
@ -41,12 +42,17 @@ class ShowformscriptsController(BaseController):
responses for autocompletion of fields."""
def index(self):
"""This action generates the helper script for the showform
page."""
"""
This action generates the helper script for the showform page.
"""
response.headers['Content-Type'] = 'text/javascript; charset=utf-8'
return render('/showformscript.mako')
def fetchdddata(self):
"""
This action fetches the data for a given mail address and
returns them as JSON.
"""
schema = DDDataRequest()
try:
formencode.api.set_stdtranslation(

View file

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
#
# DDPortfolio service TemplateController
# Copyright © 2009, 2010 Jan Dittberner <jan@dittberner.info>
# Copyright © 2009, 2010, 2011, 2012 Jan Dittberner <jan@dittberner.info>
#
# This file is part of DDPortfolio service.
#
@ -22,6 +22,7 @@
#
from ddportfolioservice.lib.base import BaseController
class TemplateController(BaseController):
def view(self, url):