Update meta information and documentation

This commit is contained in:
Jan Dittberner 2015-11-12 22:19:24 +01:00
parent c9ae85c2c1
commit 0df84e586f
10 changed files with 105 additions and 121 deletions

View file

@ -1,3 +1,6 @@
2015-11-12 Jan Dittberner <jan@dittberner.info>
* port to Python 3 and Flask
2015-03-09 Jan Dittberner <jan@dittberner.info> 2015-03-09 Jan Dittberner <jan@dittberner.info>
* apply patch for DMD link by Paul Wise * apply patch for DMD link by Paul Wise

View file

@ -1,3 +1,2 @@
include debianmemberportfolio/config/deployment.ini_tmpl recursive-include debianmemberportfolio/static *
recursive-include debianmemberportfolio/public *
recursive-include debianmemberportfolio/templates * recursive-include debianmemberportfolio/templates *

View file

@ -1,4 +1,25 @@
# -*- python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#
# Debian Member Portfolio Service Flask configuration
#
# Copyright © 2015 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
# 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
# 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 <https://www.gnu.org/licenses/>.
#
WTF_CSRF_ENABLED = False WTF_CSRF_ENABLED = False

View file

@ -25,7 +25,7 @@ import logging
from debianmemberportfolio import app, babel from debianmemberportfolio import app, babel
from flask import g, make_response, request, render_template, abort from flask import g, make_response, request, render_template, abort
from flask.ext.babel import gettext as _, lazy_gettext as N_ from flask.ext.babel import lazy_gettext as N_
from config import LANGUAGES from config import LANGUAGES
from .forms import DeveloperData, DeveloperDataRequest from .forms import DeveloperData, DeveloperDataRequest
from .model import dddatabuilder from .model import dddatabuilder

View file

@ -1,16 +1,15 @@
Development of Debian Member Portfolio Service Development of Debian Member Portfolio Service
============================================== ==============================================
The Debian Member Portfolio Service is implemented in `Python The Debian Member Portfolio Service is implemented in `Python 3
<https://www.python.org>`_ using the `Pylons <https://www.python.org>`_ using the `Flask <http://flask.pocoo.org/>`_ web
<https://pylons.readthedocs.org/en/latest/>`_ web application application framework.
framework.
The following sections describe how to setup a local development environment The following sections describe how to setup a local development environment
for the Debian Member Portfolio Service. for the Debian Member Portfolio Service.
All instructions assume that you work on a Debian system. You should use Python All instructions assume that you work on a Debian system. You should use Python
2.7 for development. 3 for development.
Setup of a local development Setup of a local development
---------------------------- ----------------------------
@ -22,53 +21,48 @@ To start working on the source code you need to have `git`_ installed::
.. _git: http://www.git-scm.com/ .. _git: http://www.git-scm.com/
The canonical git repository for the Debian Member Portfolio Service is The canonical git repository for the Debian Member Portfolio Service is
available at http://debianstuff.dittberner.info/git/debianmemberportfolio.git. available at https://debianstuff.dittberner.info/git/debianmemberportfolio.git.
To get a clone of the source code you change to a directory of your choice and To get a clone of the source code you change to a directory of your choice and
invoke git clone:: invoke git clone::
cd ~/src cd ~/src
git clone http://debianstuff.dittberner.info/git/debianmemberportfolio.git git clone https://debianstuff.dittberner.info/git/debianmemberportfolio.git
You should use `virtualenv`_ to separate the development environment from your You should use `venv`_ to separate the development environment from your
system wide Python installation. You can install virtualenv using:: system wide Python installation. You can install virtualenv using::
sudo aptitude install python-virtualenv sudo aptitude install python3-venv
.. _virtualenv: https://pypi.python.org/pypi/virtualenv .. _venv: https://docs.python.org/3/library/venv.html
When you have :command:`virtualenv` installed you should create a virtual When you have :command:`pyvenv` installed you should create a virtual
environment for Debian Member Portfolio Service development and install the environment for Debian Member Portfolio Service development and install the
requirements using `pip <https://pypi.python.org/pypi/pip>`_:: requirements using `pip <https://pypi.python.org/pypi/pip>`_::
mkdir ~/.virtualenvs mkdir ~/.virtualenvs
virtualenv --distribute ~/.virtualenvs/dmportfolio pyvenv ~/.virtualenvs/dmportfolio
. ~/.virtualenvs/dmportfolio/bin/activate . ~/.virtualenvs/dmportfolio/bin/activate
cd ~/src/debianmemberportfolio cd ~/src/debianmemberportfolio
pip install -r jessiereq.pip pip install -r stretchreq.pip
.. note:: .. note::
The Debian Member Portfolio Service instance at http://portfolio.debian.net/ The Debian Member Portfolio Service instance at http://portfolio.debian.net/
is running on a Debian Jessie server, therefore :file:`jessiereq.pip` is running on a Debian Stretch server, therefore :file:`stretchreq.pip`
contains dependency versions matching that Debian release. contains dependency versions matching that Debian release.
The dependency download and installation into the virtual environment takes The dependency download and installation into the virtual environment takes
some time. some time.
After you have your virtual environment ready you need to setup the project for
development::
python setup.py develop
Debian Member Portfolio Service needs the JQuery JavaScript library to function Debian Member Portfolio Service needs the JQuery JavaScript library to function
properly. The JQuery library is not included in the git clone and must be properly. The JQuery library is not included in the git clone and must be
copied into the subdirectory copied into the subdirectory
:file:`debianmemberportfolio/public/javascript/jquery`. On Debian systems you :file:`debianmemberportfolio/static/javascript/jquery`. On Debian systems you
can install the package libjs-jquery and place a symlink to the directory can install the package libjs-jquery and place a symlink to the directory
:file:`/usr/share/javascript` into :file:`debianmemberportfolio/public`: :: :file:`/usr/share/javascript` into :file:`debianmemberportfolio/static`: ::
sudo aptitude install libjs-jquery sudo aptitude install libjs-jquery
ln -s /usr/share/javascript debianmemberportfolio/public ln -s /usr/share/javascript debianmemberportfolio/static
Prepare for first startup Prepare for first startup
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
@ -93,21 +87,19 @@ When you have both installed you can run::
The first synchronizes the keyrings in :file:`$HOME/debian/keyring.debian.org` The first synchronizes the keyrings in :file:`$HOME/debian/keyring.debian.org`
with files on the `keyring.debian.org <http://keyring.debian.org>`_ host. And with files on the `keyring.debian.org <http://keyring.debian.org>`_ host. And
the second generates a key/value database in the second generates a key/value database in
:file:`debianmemberportfolio/model/keyringcache` that is used by the code. :file:`debianmemberportfolio/model/keyringcache.db` that is used by the code.
Run a development server Run a development server
~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
Pylons uses PasteScript to run a development server. You can run a development You can run a development server using::
server using::
paster serve --reload development.ini python3 run.py
The output of this command should look like the following:: The output of this command should look like the following::
Starting subprocess with file monitor * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
Starting server in PID 31377. * Restarting with stat
serving on http://127.0.0.1:5000
You can now access your development server at the URL that is printed by the command. You can now access your development server at the URL that is printed by the command.
@ -122,21 +114,17 @@ Add new URL
Debian Member Portfolio Service uses a ini style configuration file Debian Member Portfolio Service uses a ini style configuration file
:file:`debianmemberportfolio/model/portfolio.ini` to configure the generated URL :file:`debianmemberportfolio/model/portfolio.ini` to configure the generated URL
patterns. The actual URL generation is done in patterns. The actual URL generation is done in
:py:class:`~debianmemberportfolio.controllers.portfolio.DdportfolioController` :py:func:`~debianmemberportfolio.views.urllist`.
in the
:py:meth:`~debianmemberportfolio.controllers.portfolio.DdportfolioController.urllist`
method.
If you want to add a new URL type you have to add a line in If you want to add a new URL type you have to add a line in
:file:`portfolio.ini` and an entry in :file:`portfolio.ini` and an entry in :py:mod:`~debianmemberportfolio.views`'s
:py:class:`~debianmemberportfolio.controllers.portfolio.DdportfolioController`'s :py:attr:`~debianmemberportfolio.views._LABELS` dictionary. The top level
:py:attr:`~debianmemberportfolio.controllers.portfolio.DdportfolioController._LABELS` dictionary keys correspond to sections in the ini file. The dictionary values
dictionary. The top level dictionary keys correspond to sections in the ini are dictionaries themselves that contain a special key ``label`` that defines
file. The dictionary values are dictionaries themselves that contain a special the label of the section in the output and keys for each entry to be rendered
key ``label`` that defines the label of the section in the output and keys for in that section. The values in these sub-dictionaries are strings marked for
each entry to be rendered in that section. The values in these sub-dictionaries translation using the :py:func:`~flask.ext.babel.lazy_gettext` function from
are strings marked for translation using the :py:func:`~pylons.i18n._` function from :py:mod:`flask.ext.babel`.
:py:mod:`pylons.i18n`.
The patterns in :file:`portfolio.ini` can contain the following placeholders The patterns in :file:`portfolio.ini` can contain the following placeholders
that are filled at runtime: that are filled at runtime:
@ -148,7 +136,7 @@ Placeholder Replacement
%(email)s email address (URL encoded) %(email)s email address (URL encoded)
%(emailnoq)s email address %(emailnoq)s email address
%(firstchar)s first character of the email address %(firstchar)s first character of the email address
%(forumsid)d forum user id %(forumsid)s forum user id
%(gpgfp)s GNUPG/PGP key fingerprint %(gpgfp)s GNUPG/PGP key fingerprint
%(name)s full name (i.e. John Smith) %(name)s full name (i.e. John Smith)
%(username)s Debian user name %(username)s Debian user name
@ -158,10 +146,9 @@ Placeholder Replacement
.. _alioth.debian.org: https://alioth.debian.org/ .. _alioth.debian.org: https://alioth.debian.org/
The replacement of placeholders is performed in the The replacement of placeholders is performed in the
:py:meth:`~debianmemberportfolio.controllers.portfolio.DdportfolioController.urllist` :py:func:`~debianmemberportfolio.views.urllist` function. And uses data from
method. And uses data from the Debian keyring. Access to the pre-parsed keyring the Debian keyring. Access to the pre-parsed keyring data is performed using
data is performed using the the :py:func:`~debianmemberportfolio.model.dddatabuilder.build_data` function
:py:func:`~debianmemberportfolio.model.dddatabuilder.build_data` function of of the module :py:mod:`debianmemberportfolio.model.dddatabuilder`, which uses
the module :py:mod:`debianmemberportfolio.model.dddatabuilder`, which uses
several helper functions from :py:mod:`debianmemberportfolio.model.keyfinder` several helper functions from :py:mod:`debianmemberportfolio.model.keyfinder`
to access the key information. to access the key information.

View file

@ -4,58 +4,16 @@ Source documentation
The sections below contain mostly autogenerated documentation of the source The sections below contain mostly autogenerated documentation of the source
code of the Debian Member Portfolio Service. code of the Debian Member Portfolio Service.
Controllers Forms
----------- -----
.. automodule:: debianmemberportfolio.controllers .. automodule:: debianmemberportfolio.forms
:members: :members:
portfolio controller Views
~~~~~~~~~~~~~~~~~~~~ -----
.. automodule:: debianmemberportfolio.controllers.portfolio .. automodule:: debianmemberportfolio.views
:members:
error controller
~~~~~~~~~~~~~~~~
.. automodule:: debianmemberportfolio.controllers.error
:members:
showformscripts controller
~~~~~~~~~~~~~~~~~~~~~~~~~~
.. automodule:: debianmemberportfolio.controllers.showformscripts
:members:
template controller
~~~~~~~~~~~~~~~~~~~
.. automodule:: debianmemberportfolio.controllers.template
:members:
Library code
------------
.. automodule:: debianmemberportfolio.lib
:members:
app_globals
~~~~~~~~~~~
.. automodule:: debianmemberportfolio.lib.app_globals
:members:
base
~~~~
.. automodule:: debianmemberportfolio.lib.base
:members:
helpers
~~~~~~~
.. automodule:: debianmemberportfolio.lib.helpers
:members: :members:
Model Model
@ -70,12 +28,6 @@ dddatabuilder
.. automodule:: debianmemberportfolio.model.dddatabuilder .. automodule:: debianmemberportfolio.model.dddatabuilder
:members: :members:
form
~~~~
.. automodule:: debianmemberportfolio.model.form
:members:
keyfinder keyfinder
~~~~~~~~~ ~~~~~~~~~

24
run.py
View file

@ -1,4 +1,26 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
# -*- python -*-
# -*- coding: utf-8 -*-
#
# Debian Member Portfolio Service Flask runner
#
# Copyright © 2015 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
# 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
# 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 <https://www.gnu.org/licenses/>.
#
from debianmemberportfolio import app from debianmemberportfolio import app
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -12,29 +12,28 @@ doc-dir=docs/html
make-dirs=1 make-dirs=1
[nosetests] [nosetests]
with-pylons = test.ini
cover-package = debianmemberportfolio cover-package = debianmemberportfolio
# Babel configuration # Babel configuration
[compile_catalog] [compile_catalog]
domain = debianmemberportfolio domain = messages
directory = debianmemberportfolio/i18n directory = debianmemberportfolio/translations
statistics = true statistics = true
[extract_messages] [extract_messages]
charset = UTF-8 charset = UTF-8
add_comments = TRANSLATORS: add_comments = TRANSLATORS:
output_file = debianmemberportfolio/i18n/debianmemberportfolio.pot output_file = messages.pot
width = 80 width = 80
msgid_bugs_address = jan@dittberner.info msgid_bugs_address = jan@dittberner.info
[init_catalog] [init_catalog]
domain = debianmemberportfolio domain = messages
input_file = debianmemberportfolio/i18n/debianmemberportfolio.pot input_file = messages.pot
output_dir = debianmemberportfolio/i18n output_dir = debianmemberportfolio/translations
[update_catalog] [update_catalog]
domain = debianmemberportfolio domain = messages
input_file = debianmemberportfolio/i18n/debianmemberportfolio.pot input_file = messages.pot
output_dir = debianmemberportfolio/i18n output_dir = debianmemberportfolio/translations
previous = true previous = true

View file

@ -46,15 +46,16 @@ setup(
author_email='jan@dittberner.info', author_email='jan@dittberner.info',
url='http://debian-stuff.dittberner.info/debianmemberportfolio', url='http://debian-stuff.dittberner.info/debianmemberportfolio',
license='AGPL-3.0+', license='AGPL-3.0+',
install_requires=["Flask>=0.10.1", 'babel>=0.9.6'], install_requires=["Flask>=0.10.1", 'Babel>=1.3', 'Flask-Babel>=0.9'],
packages=find_packages(exclude=['ez_setup']), packages=find_packages(exclude=['ez_setup']),
include_package_data=True, include_package_data=True,
test_suite='nose.collector', test_suite='nose.collector',
package_data={'debianmemberportfolio': package_data={'debianmemberportfolio':
['*.ini', 'i18n/*/LC_MESSAGES/*.mo']}, ['*.ini', 'translations/*/LC_MESSAGES/*.mo']},
message_extractors={'debianmemberportfolio': [ message_extractors={'debianmemberportfolio': [
('**.py', 'python', None), ('**.py', 'python', None),
('templates/**.mako', 'mako', None), ('templates/**.html', 'jinja2', None),
('public/**', 'ignore', None)]}, ('templates/**.js', 'jinja2', None),
('static/**', 'ignore', None)]},
zip_safe=False, zip_safe=False,
) )

View file

@ -3,7 +3,7 @@ Jinja2==2.8
MarkupSafe==0.23 MarkupSafe==0.23
Werkzeug==0.10.4 Werkzeug==0.10.4
itsdangerous==0.24 itsdangerous==0.24
Babel==1.3 Babel==2.1.1
Flask-Babel==0.9 Flask-Babel==0.9
pytz==2012c pytz==2012c
speaklater==1.3 speaklater==1.3