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,24 +1,24 @@
|
|||
# -*- python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# DDPortfolio service model package
|
||||
# Copyright (c) 2009 Jan Dittberner <jan@dittberner.info>
|
||||
# Debian Member Portfolio Service model 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/>.
|
||||
#
|
||||
"""
|
||||
Model classes and model related utilities for the Debian Member Portfolio
|
||||
|
|
|
@ -1,29 +1,32 @@
|
|||
# -*- python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# DDPortfolio service DD data builder
|
||||
# Copyright © 2009, 2010 Jan Dittberner <jan@dittberner.info>
|
||||
# Debian Member Portfolio Service data builder
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
"""This file contains code to build a representation of a person based
|
||||
on keyring data associated to a given email address."""
|
||||
# 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 code to build a representation of a person based on keyring
|
||||
data associated to a given email address.
|
||||
"""
|
||||
|
||||
import logging
|
||||
from ddportfolioservice.model import keyfinder
|
||||
from debianmemberportfolio.model import keyfinder
|
||||
|
||||
TYPE_NO = 0
|
||||
TYPE_DM = 1
|
||||
|
@ -34,11 +37,11 @@ log = logging.getLogger(__name__)
|
|||
|
||||
def build_data(email_address):
|
||||
"""Build a DD data structure from a given email address."""
|
||||
fields = dict([(field, func(str(email_address))) \
|
||||
for (field, func) in \
|
||||
[('gpgfp', keyfinder.getFingerprintByEmail),
|
||||
('name', keyfinder.getRealnameByEmail),
|
||||
('username', keyfinder.getLoginByEmail)]])
|
||||
fields = dict([(field, func(str(email_address)))
|
||||
for (field, func) in
|
||||
[('gpgfp', keyfinder.getFingerprintByEmail),
|
||||
('name', keyfinder.getRealnameByEmail),
|
||||
('username', keyfinder.getLoginByEmail)]])
|
||||
fields['email'] = email_address
|
||||
if fields['username'] and fields['gpgfp'] and fields['name']:
|
||||
fields['type'] = TYPE_DD
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Debian Member Portfolio Service form handling model
|
||||
#
|
||||
# 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,10 @@
|
|||
# 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 form definitions used in the controllers.
|
||||
"""
|
||||
|
||||
import formencode
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Debian Member Portfolio Service key finder module
|
||||
# Copyright (c) 2009-2014 Jan Dittberner <jan@dittberner.info>
|
||||
#
|
||||
# This file is part of Debian Member Portfolio Service.
|
||||
# Copyright © 2009-2014 Jan Dittberner <jan@dittberner.info>
|
||||
#
|
||||
# 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
|
||||
|
@ -16,13 +17,14 @@
|
|||
# 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/>.
|
||||
# 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 provides tools for finding PGP key information from a
|
||||
given keyring.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import time
|
||||
import sys
|
||||
|
|
|
@ -1,25 +1,24 @@
|
|||
# -*- python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Debian Member Portfolio service application key ring analyzer tool
|
||||
# Debian Member Portfolio Service application key ring analyzer tool
|
||||
#
|
||||
# Copyright © 2009-2014 Jan Dittberner <jan@dittberner.info>
|
||||
#
|
||||
# This file is part of the 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
|
||||
# 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.
|
||||
# published by the Free Software Foundation, either version 3 of the License,
|
||||
# or (at your option) any later version.
|
||||
#
|
||||
# Debian Member Portfolio service is distributed in the hope that it will be
|
||||
# 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/>.
|
||||
# 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 is a tool that analyzes GPG and PGP keyrings and stores the
|
||||
|
@ -45,7 +44,7 @@ CONFIG = ConfigParser.SafeConfigParser()
|
|||
def _get_keyrings():
|
||||
"""
|
||||
Gets the available keyring files from the keyring directory
|
||||
configured in ddportfolio.ini.
|
||||
configured in portfolio.ini.
|
||||
"""
|
||||
keyringdir = os.path.expanduser(CONFIG.get('DEFAULT', 'keyring.dir'))
|
||||
logging.debug("keyring dir is %s", keyringdir)
|
||||
|
@ -175,7 +174,7 @@ def process_keyrings():
|
|||
if __name__ == '__main__':
|
||||
logging.basicConfig(stream=sys.stderr, level=logging.WARNING)
|
||||
CONFIG.readfp(pkg_resources.resource_stream(
|
||||
__name__, 'ddportfolio.ini'))
|
||||
__name__, 'portfolio.ini'))
|
||||
gpghome = os.path.expanduser(CONFIG.get('DEFAULT', 'gnupghome'))
|
||||
if not os.path.isdir(gpghome):
|
||||
os.makedirs(gpghome, 0700)
|
||||
|
|
|
@ -1,40 +1,40 @@
|
|||
# -*- python -*-
|
||||
# -*- coding: utf8 -*-
|
||||
#
|
||||
# DDPortfolio service url builder
|
||||
# Copyright © 2009, 2010, 2011, 2012 Jan Dittberner <jan@dittberner.info>
|
||||
# Debian Member Portfolio Service url builder
|
||||
#
|
||||
# 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 module provides the function build_urls to build personalized
|
||||
URLs using the given information and the URL patterns defined in
|
||||
ddportfolio.ini.
|
||||
portfolio.ini.
|
||||
"""
|
||||
|
||||
from ConfigParser import ConfigParser, InterpolationMissingOptionError
|
||||
import pkg_resources
|
||||
from ddportfolioservice.model import keyfinder
|
||||
from debianmemberportfolio.model import keyfinder
|
||||
from urllib import quote_plus
|
||||
from pylons.i18n.translation import _, N_
|
||||
|
||||
|
||||
my_config = ConfigParser()
|
||||
my_config.readfp(pkg_resources.resource_stream(__name__, 'ddportfolio.ini'))
|
||||
my_config.readfp(pkg_resources.resource_stream(__name__, 'portfolio.ini'))
|
||||
|
||||
_FIELDNAMES_MAP = {
|
||||
'email': N_('Email address'),
|
||||
|
@ -43,7 +43,7 @@ _FIELDNAMES_MAP = {
|
|||
'username': N_('Debian user name'),
|
||||
'nonddemail': N_('Non Debian email address'),
|
||||
'aliothusername': N_('Alioth user name'),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class DDPortfolioEntry(object):
|
||||
|
@ -57,10 +57,10 @@ class DDPortfolioEntry(object):
|
|||
self.type = 'url'
|
||||
|
||||
|
||||
def build_urls(fields):
|
||||
"""Build personalized URLs using the developer information in
|
||||
fields."""
|
||||
data = []
|
||||
def _build_quoted_fields(fields):
|
||||
"""
|
||||
Take a dictionary of raw field values and quote the values if required.
|
||||
"""
|
||||
qfields = {}
|
||||
for key, value in fields.iteritems():
|
||||
if value is not None:
|
||||
|
@ -77,25 +77,33 @@ def build_urls(fields):
|
|||
qfields['gpgfp'] = fpr[0]
|
||||
qfields['firstchar'] = fields['email'][0].encode('utf8')
|
||||
qfields['emailnoq'] = fields['email'].encode('utf8')
|
||||
for section in [section.strip() for section in \
|
||||
my_config.get('DEFAULT',
|
||||
'urlbuilder.sections').split(',')]:
|
||||
return qfields
|
||||
|
||||
|
||||
def build_urls(fields):
|
||||
"""Build personalized URLs using the developer information in
|
||||
fields."""
|
||||
data = []
|
||||
qfields = _build_quoted_fields(fields)
|
||||
for section in [section.strip() for section in
|
||||
my_config.get('DEFAULT',
|
||||
'urlbuilder.sections').split(',')]:
|
||||
data.append(['section', section])
|
||||
if my_config.has_option(section, 'urls'):
|
||||
for entry in ([
|
||||
DDPortfolioEntry(my_config, section, url) for url in \
|
||||
my_config.get(section, 'urls').split(',')]):
|
||||
DDPortfolioEntry(my_config, section, url) for url in
|
||||
my_config.get(section, 'urls').split(',')]):
|
||||
try:
|
||||
data.append(
|
||||
['url', section, entry,
|
||||
my_config.get(section, entry.name + '.pattern',
|
||||
False, qfields)])
|
||||
my_config.get(section, entry.name + '.pattern',
|
||||
False, qfields)])
|
||||
except InterpolationMissingOptionError, e:
|
||||
if not entry.optional:
|
||||
if e.reference in _FIELDNAMES_MAP:
|
||||
data.append(['error', section, entry,
|
||||
_('Missing input: %s') % \
|
||||
_(_FIELDNAMES_MAP[e.reference])])
|
||||
_('Missing input: %s') %
|
||||
_(_FIELDNAMES_MAP[e.reference])])
|
||||
else:
|
||||
data.append(['error', section, entry,
|
||||
_('Missing input: %s') % e.reference])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue