switch from ddportfolio to debianmemberportfolio
- change all references from ddportfolio to debianmemberportfolio - rename debianmemberportfolio.controllers.DDPortfolioController to debianmemberportfolio.controllers.Controller - update documentation - update copyright years, unify file header formatting
This commit is contained in:
parent
780e10494e
commit
b670f58c7a
45 changed files with 1217 additions and 1123 deletions
|
|
@ -1,22 +1,22 @@
|
|||
# -*- python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# DDPortfolio service controllers package
|
||||
# Copyright © 2009, 2010 Jan Dittberner <jan@dittberner.info>
|
||||
# Debian Member Portfolio Service controllers package
|
||||
#
|
||||
# This file is part of DDPortfolio service.
|
||||
# Copyright © 2009-2014 Jan Dittberner <jan@dittberner.info>
|
||||
#
|
||||
# DDPortfolio service is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Affero General Public License
|
||||
# as published by the Free Software Foundation, either version 3 of
|
||||
# the License, or (at your option) any later version.
|
||||
# This file is part of the Debian Member Portfolio Service.
|
||||
#
|
||||
# DDPortfolio service is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Affero General Public License for more details.
|
||||
# Debian Member Portfolio Service is free software: you can redistribute it
|
||||
# and/or modify it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the License,
|
||||
# or (at your option) any later version.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public
|
||||
# License along with this program. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# Debian Member Portfolio Service is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
# -*- python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# DDPortfolio service ErrorController
|
||||
# Copyright © 2009, 2010, 2011, 2012 Jan Dittberner <jan@dittberner.info>
|
||||
# Debian Member Portfolio Service ErrorController
|
||||
#
|
||||
# This file is part of DDPortfolio service.
|
||||
# Copyright © 2009-2014 Jan Dittberner <jan@dittberner.info>
|
||||
#
|
||||
# DDPortfolio service is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Affero General Public License
|
||||
# as published by the Free Software Foundation, either version 3 of
|
||||
# the License, or (at your option) any later version.
|
||||
# This file is part of the Debian Member Portfolio Service.
|
||||
#
|
||||
# DDPortfolio service is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Affero General Public License for more details.
|
||||
# Debian Member Portfolio Service is free software: you can redistribute it
|
||||
# and/or modify it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the License,
|
||||
# or (at your option) any later version.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public
|
||||
# License along with this program. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# Debian Member Portfolio Service is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
import cgi
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ from pylons.controllers.util import forward
|
|||
from pylons.middleware import error_document_template
|
||||
from webhelpers.html.builder import literal
|
||||
|
||||
from ddportfolioservice.lib.base import BaseController
|
||||
from debianmemberportfolio.lib.base import BaseController
|
||||
|
||||
|
||||
class ErrorController(BaseController):
|
||||
|
|
@ -49,7 +49,7 @@ class ErrorController(BaseController):
|
|||
page = error_document_template % \
|
||||
dict(prefix=request.environ.get('SCRIPT_NAME', ''),
|
||||
code=cgi.escape(
|
||||
request.GET.get('code', str(resp.status_int))),
|
||||
request.GET.get('code', str(resp.status_int))),
|
||||
message=content)
|
||||
return page
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
# -*- python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Debian Member Portfolio Service DdportfolioController
|
||||
# Debian Member Portfolio Service PortfolioController
|
||||
#
|
||||
# Copyright © 2009-2014 Jan Dittberner <jan@dittberner.info>
|
||||
#
|
||||
# This file is part of Debian Member Portfolio Service.
|
||||
# This file is part of the Debian Member Portfolio Service.
|
||||
#
|
||||
# Debian Member Portfolio Service is free software: you can redistribute it
|
||||
# and/or modify it under the terms of the GNU Affero General Public License as
|
||||
|
|
@ -19,6 +20,11 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
"""
|
||||
This module defines the PortfolioController class used to render the portfolio
|
||||
of a person.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import simplejson
|
||||
|
||||
|
|
@ -27,18 +33,19 @@ from pylons.i18n import N_, _
|
|||
import formencode.api
|
||||
import formencode.validators
|
||||
|
||||
from ddportfolioservice.lib.base import BaseController, render
|
||||
from ddportfolioservice.model.form import DDDataRequest, DeveloperData
|
||||
from ddportfolioservice.model.urlbuilder import build_urls
|
||||
from ddportfolioservice.model import dddatabuilder
|
||||
from debianmemberportfolio.lib.base import BaseController, render
|
||||
from debianmemberportfolio.model.form import DDDataRequest, DeveloperData
|
||||
from debianmemberportfolio.model.urlbuilder import build_urls
|
||||
from debianmemberportfolio.model import dddatabuilder
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DdportfolioController(BaseController):
|
||||
class PortfolioController(BaseController):
|
||||
"""
|
||||
Main controller for the Debian Member portfolio service.
|
||||
Main controller for the Debian Member Portfolio Service.
|
||||
"""
|
||||
#: This dictionary defines groups of labeled portfolio items.
|
||||
_LABELS = {
|
||||
'overview': {
|
||||
'label': N_('Overview'),
|
||||
|
|
@ -123,6 +130,15 @@ developer name on all bug logs)'),
|
|||
},
|
||||
}
|
||||
|
||||
#: list of field name tuples for Debian Maintainers
|
||||
DM_TUPLES = (('name', 'name'),
|
||||
('gpgfp', 'gpgfp'),
|
||||
('nonddemail', 'email'))
|
||||
|
||||
#: list of field name tuples for Debian Developers
|
||||
DD_TUPLES = (('username', 'username'),
|
||||
('aliothusername', 'username'))
|
||||
|
||||
def _get_label(self, section, url=None):
|
||||
if section in self._LABELS:
|
||||
if url:
|
||||
|
|
@ -140,35 +156,34 @@ developer name on all bug logs)'),
|
|||
"""
|
||||
return render('/showform.mako')
|
||||
|
||||
def urllist(self):
|
||||
"""Handle the actual data."""
|
||||
def _build_request_params(self):
|
||||
schema = DDDataRequest()
|
||||
try:
|
||||
formencode.api.set_stdtranslation(
|
||||
domain="FormEncode",
|
||||
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()}
|
||||
return render('/showform.mako')
|
||||
formencode.api.set_stdtranslation(
|
||||
domain="FormEncode",
|
||||
languages=[lang[0:2] for lang in request.languages])
|
||||
form_result = schema.to_python(request.params)
|
||||
fields = dddatabuilder.build_data(form_result['email'])
|
||||
rp = request.params.copy()
|
||||
|
||||
DM_TUPLES = (('name', 'name'),
|
||||
('gpgfp', 'gpgfp'),
|
||||
('nonddemail', 'email'))
|
||||
DD_TUPLES = (('username', 'username'),
|
||||
('aliothusername', 'username'))
|
||||
|
||||
if fields['type'] in (dddatabuilder.TYPE_DD, dddatabuilder.TYPE_DM):
|
||||
for tuple in DM_TUPLES:
|
||||
for tuple in self.DM_TUPLES:
|
||||
if not tuple[0] in rp or not rp[tuple[0]]:
|
||||
rp[tuple[0]] = fields[tuple[1]]
|
||||
if fields['type'] == dddatabuilder.TYPE_DD:
|
||||
for tuple in DD_TUPLES:
|
||||
for tuple in self.DD_TUPLES:
|
||||
if not tuple[0] in rp or not rp[tuple[0]]:
|
||||
rp[tuple[0]] = fields[tuple[1]]
|
||||
|
||||
return rp
|
||||
|
||||
def urllist(self):
|
||||
"""Handle the actual data."""
|
||||
try:
|
||||
rp = self._build_request_params()
|
||||
except formencode.validators.Invalid as error:
|
||||
c.messages = {'errors': error.unpack_errors()}
|
||||
return render('/showform.mako')
|
||||
|
||||
schema = DeveloperData()
|
||||
try:
|
||||
formencode.api.set_stdtranslation(
|
||||
|
|
|
|||
|
|
@ -1,36 +1,42 @@
|
|||
# -*- python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# DDPortfolio service ShowformscriptController.
|
||||
# Copyright © 2009, 2010, 2011, 2012 Jan Dittberner <jan@dittberner.info>
|
||||
# Debian Member Portfolio Service ShowformscriptsController.
|
||||
#
|
||||
# This file is part of DDPortfolio service.
|
||||
# Copyright © 2009-2014 Jan Dittberner <jan@dittberner.info>
|
||||
#
|
||||
# DDPortfolio service is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Affero General Public License
|
||||
# as published by the Free Software Foundation, either version 3 of
|
||||
# the License, or (at your option) any later version.
|
||||
# This file is part of the Debian Member Portfolio Service.
|
||||
#
|
||||
# DDPortfolio service is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Affero General Public License for more details.
|
||||
# Debian Member Portfolio Service is free software: you can redistribute it
|
||||
# and/or modify it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the License,
|
||||
# or (at your option) any later version.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public
|
||||
# License along with this program. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# Debian Member Portfolio Service is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
"""
|
||||
This file defines the ShowformscriptsController used to generate the JavaScript
|
||||
code in forms.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import simplejson
|
||||
|
||||
from pylons import request, response
|
||||
from pylons.controllers.util import abort
|
||||
|
||||
import formencode.api
|
||||
import formencode.validators
|
||||
|
||||
from ddportfolioservice.lib.base import BaseController, render
|
||||
from ddportfolioservice.model.form import DDDataRequest
|
||||
from ddportfolioservice.model import dddatabuilder
|
||||
from debianmemberportfolio.lib.base import BaseController, render
|
||||
from debianmemberportfolio.model.form import DDDataRequest
|
||||
from debianmemberportfolio.model import dddatabuilder
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -62,7 +68,7 @@ class ShowformscriptsController(BaseController):
|
|||
except formencode.validators.Invalid, error:
|
||||
errors = error.unpack_errors()
|
||||
abort(400, "\n".join(
|
||||
["%s: %s" % (key, errors[key]) for key in errors]))
|
||||
["%s: %s" % (key, errors[key]) for key in errors]))
|
||||
fields = dddatabuilder.build_data(form_result['email'])
|
||||
log.debug(fields)
|
||||
response.headers['Content-Type'] = 'text/plain'
|
||||
|
|
|
|||
|
|
@ -1,26 +1,31 @@
|
|||
# -*- python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# DDPortfolio service TemplateController
|
||||
# Copyright © 2009, 2010, 2011, 2012 Jan Dittberner <jan@dittberner.info>
|
||||
# Debian Member Portfolio Service TemplateController
|
||||
#
|
||||
# This file is part of DDPortfolio service.
|
||||
# Copyright © 2009-2014 Jan Dittberner <jan@dittberner.info>
|
||||
#
|
||||
# DDPortfolio service is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Affero General Public License
|
||||
# as published by the Free Software Foundation, either version 3 of
|
||||
# the License, or (at your option) any later version.
|
||||
# This file is part of the Debian Member Portfolio Service.
|
||||
#
|
||||
# DDPortfolio service is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Affero General Public License for more details.
|
||||
# Debian Member Portfolio Service is free software: you can redistribute it
|
||||
# and/or modify it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the License,
|
||||
# or (at your option) any later version.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public
|
||||
# License along with this program. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# Debian Member Portfolio Service is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
|
||||
# General Public License for more details.
|
||||
#
|
||||
from ddportfolioservice.lib.base import BaseController
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
"""
|
||||
This file contains the TemplateController used to render templates.
|
||||
"""
|
||||
|
||||
from debianmemberportfolio.lib.base import BaseController
|
||||
from pylons.controllers.util import abort
|
||||
|
||||
|
||||
class TemplateController(BaseController):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue