Changeset - 1e9bc98a5eec
[Not reviewed]
Merge v5.3.0 default
0 6 0
Dennis Fink - 9 years ago 2015-10-28 01:08:12
dennis.fink@c3l.lu
Merged dev
6 files changed with 15 insertions and 6 deletions:
0 comments (0 inline, 0 general)
README.rst
Show inline comments
 
@@ -2,49 +2,49 @@
 
Ënnstatus
 
=========
 

	
 
Ënnstatus is a web application written in Python_ Flask_, to provide viewers
 
with vital information about the organisation and Tor_ servers of `Frënn vun
 
der Ënn A.S.B.L.`_
 

	
 
.. _Python: https://python.org
 
.. _Flask: http://flask.pooco.org
 
.. _Tor: https://torproject.lu
 
.. _Frënn vun der Ënn A.S.B.L.: https://enn.lu
 

	
 
TOC
 
===
 

	
 
- Contribute_
 

	
 
  - Versioning_
 
  - Repository_
 

	
 
    - `Branch Structure`_
 
    - `Feature Requests`_
 
    - `Pull Requests`_
 

	
 
_ Authors_
 
- Authors_
 

	
 
  - `Development Lead`_
 
  - `Contributors`_
 

	
 
.. _Contribute:
 

	
 
Contibute
 
=========
 

	
 
Versioning
 
----------
 

	
 
This project uses the `Semantic Versioning`_ system.
 

	
 
.. _Repository:
 

	
 
Repository
 
----------
 

	
 
.. _Branch Structure:
 

	
 
Branch Structure
 
++++++++++++++++
 

	
dev-requirements.txt
Show inline comments
 
#
 
# This file is autogenerated by pip-compile
 
# Make changes in dev-requirements.in, then run this to update:
 
#
 
#    pip-compile dev-requirements.in
 
#
 
click==5.1                # via pip-tools
 
docutils==0.12            # via sphinx
 
first==2.0.1              # via pip-tools
 
Flask-Script==2.0.5
 
flask==0.10.1             # via flask-script
 
itsdangerous==0.24        # via flask
 
jinja2==2.8               # via flask, sphinx
 
markupsafe==0.23          # via jinja2
 
pip-tools==1.1.3
 
pygments==2.0.2           # via sphinx
 
six==1.9.0                # via pip-tools
 
six==1.10.0               # via pip-tools
 
Sphinx==1.2.3
 
werkzeug==0.10.4          # via flask
ennstatus/donate/views.py
Show inline comments
 
# Ënnstatus
 
# Copyright (C) 2015  Dennis Fink
 
#
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program 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 General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
from decimal import Decimal
 
from flask import (Blueprint, render_template, request,
 
                   redirect, url_for, current_app)
 

	
 
from babel.numbers import parse_decimal, format_decimal
 

	
 
from ennstatus.donate.forms import DateForm
 
from ennstatus.donate.functions import load_csv, get_choices
 

	
 
from ennstatus.root.forms import BPMForm
 
from ennstatus.root.constants import BPM_ADDRESSES
 

	
 
donate_page = Blueprint('donate', __name__)
 

	
 

	
 
@donate_page.route('/', methods=('GET', 'POST'))
 
def index():
 

	
 
    current_app.logger.info('Handling index')
 
    form = BPMForm()
 
    country_choices = [choice[0] for choice in form.country.choices]
 

	
 
    if request.method == 'POST':
 
        current_app.logger.debug('Validating form')
 
        if form.validate_on_submit():
 
            country = form.country.data
 
            return redirect(url_for('donate.index', country=country))
 
    else:
 
        if 'country' in request.args:
 
            country = request.args['country']
 
@@ -87,31 +88,36 @@ def received():
 
            return redirect(url_for('donate.received', year=year, month=month))
 
    else:
 
        if 'year' in request.args and 'month' in request.args:
 
            year = request.args['year']
 
            month = request.args['month']
 
            form.year.data = year
 
            form.month.data = '{:02d}'.format(int(month))
 
            filename = '-'.join([year, month])
 
            if filename in files:
 
                current_app.logger.info('Showing date %s' % filename)
 
                csv_file = load_csv(filename)
 
            else:
 
                current_app.logger.warn('Date %s not found' % filename)
 
                return render_template('donate/received.html',
 
                                       form=form, csv_file=None,
 
                                       year=year, month=month, total=None)
 
        else:
 
            filename = files[-1]
 
            current_app.logger.info('Showing last date %s' % filename)
 
            year, month = filename.split('-')
 
            form.year.data = year
 
            form.month.data = '{:02d}'.format(int(month))
 
            csv_file = load_csv(filename)
 

	
 
        total = str(sum(Decimal(row[2].replace(',', '.')) for row in csv_file))
 
        total = format_decimal(
 
            sum(
 
                parse_decimal(row[2], locale='de') for row in csv_file
 
            ),
 
            locale='de'
 
        )
 
        csv_file = load_csv(filename)
 

	
 
        current_app.logger.info('Return result')
 
        return render_template('donate/received.html',
 
                               form=form, csv_file=csv_file,
 
                               year=year, month=month, total=total)
requirements.in
Show inline comments
 
Babel==2.1.1
 
click==5.1
 
Flask-Bootstrap==3.3.5.6
 
Flask-HTTPAuth==2.6.0
 
Flask-Mail==0.9.1
 
Flask-Moment==0.5.1
 
Flask-WTF==0.12
 
Flask==0.10.1
 
jsonschema==2.5.1
 
pygeoip==0.3.2
 
python-gnupg==0.3.7
 
requests==2.7.0
 
strict-rfc3339==0.5
requirements.txt
Show inline comments
 
#
 
# This file is autogenerated by pip-compile
 
# Make changes in requirements.in, then run this to update:
 
#
 
#    pip-compile requirements.in
 
#
 
Babel==2.1.1
 
blinker==1.4              # via flask-mail
 
click==5.1
 
dominate==2.1.12          # via flask-bootstrap
 
dominate==2.1.16          # via flask-bootstrap
 
Flask-Bootstrap==3.3.5.6
 
Flask-HTTPAuth==2.6.0
 
Flask-Mail==0.9.1
 
Flask-Moment==0.5.1
 
Flask-WTF==0.12
 
flask==0.10.1
 
itsdangerous==0.24        # via flask
 
jinja2==2.8               # via flask
 
jsonschema==2.5.1
 
markupsafe==0.23          # via jinja2
 
pygeoip==0.3.2
 
python-gnupg==0.3.7
 
pytz==2015.7              # via babel
 
requests==2.7.0
 
strict-rfc3339==0.5
 
werkzeug==0.10.4          # via flask, flask-wtf
 
wtforms==2.0.2            # via flask-wtf
setup.py
Show inline comments
 
from setuptools import setup, find_packages
 

	
 

	
 
def _get_requirements():
 

	
 
    with open('requirements.in', encoding='utf-8') as f:
 
        lines = f.readlines()
 

	
 
    lines = [line[:-1] for line in lines if not line.startswith('#')]
 
    return lines
 

	
 

	
 
setup(name='Ennstatus',
 
      version='5.2.1',
 
      version='5.3.0',
 
      description=('Ennstatus provides the user with vital information about '
 
                   'the status of the organizations Tor servers.'),
 
      author='Frënn vun der Ënn',
 
      author_email='info@enn.lu',
 
      url='https://bitbucket.org/fvde/ennstatus',
 
      license='GPLv3+',
 
      packages=find_packages(),
 
      install_requires=_get_requirements(),
 
      include_package_data=True,
 
      entry_points={
 
          'console_scripts': [
 
              'ennstatuscli = ennstatus.cli:cli',
 
          ]
 
      },
 
      classifiers=['Development Status :: 5 - Production/Stable',
 
                   'Environment :: Web Environment',
 
                   'Operating System :: POSIX',
 
                   'Programming Language :: Python',
 
                   'Programming Language :: Python :: 3',
 
                   'Programming Language :: Python :: 3.3',
 
                   'Topic :: Internet',
 
                   'Topic :: Internet :: WWW/HTTP',
 
                   'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
 
                   'Topic :: Internet :: WWW/HTTP :: WSGI',
0 comments (0 inline, 0 general)