Changeset - 2a9b3bbd587d
[Not reviewed]
Merge dev
1 6 0
Dennis Fink - 9 years ago 2016-05-20 19:37:59
dennis.fink@c3l.lu
Merged default
7 files changed with 21 insertions and 158 deletions:
0 comments (0 inline, 0 general)
ennstatus/donate/views.py
Show inline comments
 
@@ -22,40 +22,12 @@ from babel.numbers import parse_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'))
 
@donate_page.route('/')
 
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']
 
            if country in country_choices:
 
                current_app.logger.info('Showing country %s' % country)
 
            else:
 
                current_app.logger.warn('Country %s not found' % country)
 
                country = 'luxembourg'
 
        else:
 
            current_app.logger.info('Using default country')
 
            country = 'luxembourg'
 

	
 
    form.country.data = country
 
    address = BPM_ADDRESSES[country]
 

	
 
    return render_template('donate/index.html', form=form, address=address)
 
    return render_template('donate/index.html')
 

	
 

	
 
@donate_page.route('/received',
ennstatus/root/constants.py
Show inline comments
 
deleted file
ennstatus/root/forms.py
Show inline comments
 
@@ -15,28 +15,12 @@
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
from flask_wtf import Form
 
from wtforms import (SelectField,
 
                     StringField,
 
from wtforms import (StringField,
 
                     RadioField,
 
                     BooleanField,
 
                     SubmitField
 
                     )
 
from wtforms.validators import InputRequired, Email, Length, DataRequired
 

	
 

	
 
COUNTRIES = [
 
    ('luxembourg', 'Luxembourg'),
 
    ('belgium', 'Belgium'),
 
    ('france', 'France'),
 
    ('germany', 'Germany'),
 
]
 

	
 

	
 
class BPMForm(Form):
 
    country = SelectField('Country',
 
                          validators=[DataRequired()],
 
                          choices=COUNTRIES)
 
    submit = SubmitField('Submit')
 
from wtforms.validators import InputRequired, Email, Length
 

	
 

	
 
class MembershipForm(Form):
ennstatus/root/views.py
Show inline comments
 
@@ -17,8 +17,7 @@
 
from flask import (Blueprint, render_template, current_app,
 
                   request, redirect, url_for, flash)
 

	
 
from ennstatus.root.forms import BPMForm, MembershipForm, BridgeprogramForm
 
from ennstatus.root.constants import BPM_ADDRESSES
 
from ennstatus.root.forms import MembershipForm, BridgeprogramForm
 
from ennstatus.root.functions import (send_membership_mail,
 
                                      send_bridgeprogram_mail)
 

	
 
@@ -80,35 +79,9 @@ def mirrors():
 
    return render_template('root/mirrors.html')
 

	
 

	
 
@root_page.route('/contact', methods=('GET', 'POST'))
 
@root_page.route('/contact')
 
def contact():
 

	
 
    current_app.logger.info('Handling contact')
 
    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('root.contact', country=country))
 
    else:
 
        if 'country' in request.args:
 
            country = request.args['country']
 
            if country in country_choices:
 
                current_app.logger.info('Showing country %s' % country)
 
            else:
 
                current_app.logger.warn('Country %s not found' % country)
 
                country = 'luxembourg'
 
        else:
 
            current_app.logger.info('Using default country')
 
            country = 'luxembourg'
 

	
 
    form.country.data = country
 

	
 
    address = BPM_ADDRESSES[country]
 

	
 
    return render_template('root/contact.html', form=form, address=address)
 
    return render_template('root/contact.html')
 

	
 

	
 
@root_page.route('/abuse')
ennstatus/templates/donate/index.html
Show inline comments
 
@@ -83,21 +83,11 @@
 
          <h3>SnailMail</h3>
 
        </center>
 
        <div class="well well-sm">
 
          <div class="pull-right">
 
            <form class="form-inline" role="form" method="POST" action"{{ url_for('donate.index') }}">
 
              {{ form.hidden_tag() }}
 
              <div class="form-group">
 
                {{ form.country(class_='form-control input-sm', onchange='this.form.submit()') }}
 
                <noscript>{{ form.submit(class_='btn btn-enn btn-sm') }}</noscript>
 
              </div>
 
            </form>
 
          </div>
 
          <address>
 
           <address>
 
            <strong>Frënn vun der Ënn, ASBL</strong><br>
 
                    BPM 381892<br>
 
                    {{ address['address'] }}<br>
 
                    {{ address['postal_code'] }}, {{ address['city'] }}<br>
 
                    {{ address['country'] }}
 
                    {{ config['ENNSTATUS_ADDRESS'] }}<br>
 
                    {{ config['ENNSTATUS_POSTAL_CODE'] }}, {{ config['ENNSTATUS_CITY'] }}<br>
 
                    {{ config['ENNSTATUS_COUNTRY'] }}
 
          </address>
 
        </div>
 
      </div>
 
@@ -204,13 +194,12 @@
 
    <div class="col-md-4">
 
      <div class="thumbnail">
 
        <center>
 
          <h3>BPM Points</h3>
 
          <h3>Patreon</h3>
 
          <div class="well well-sm">
 
            <p>For our parcel station and international mail boxes.</p>
 
            <p>
 
              Send your BPM voucher code to: <br>
 
              <abbr title="E-Mail"><span class="glyphicon glyphicon-envelope"></span></abbr> : <a href="mailto:info@enn.lu">info@enn.lu</a> <span class="glyphicon glyphicon-lock"></span> GPG: <a href="http://keyserver.cypherpunk.lu:11371/pks/lookup?search=info@enn.lu&op=vindex" target="_blank">0x02225522</a>
 
            </p>
 
            <p>Support us!</p>
 
            <a href="https://www.patreon.com/FVDE?utm_medium=social&ty=h&utm_campaign=creatorshare" target="_blank">
 
              <img src="https://s3.amazonaws.com/patreon_public_assets/toolbox/patreon.png" alt="Patreon" title="Patreon" border="0"></img>
 
            </a>
 
          </div>
 
        </center>
 
      </div>
ennstatus/templates/root/contact.html
Show inline comments
 
@@ -26,26 +26,14 @@
 
      <h2>Contact</h2>
 
    </div>
 
  </div>
 
  <div class="col-md-8 clearfix">
 
    <h2 class="pull-left">General</h2>
 
    <div class="pull-right">
 
      <form class="form-inline" role="form" method="POST" action="{{ url_for('root.contact') }}">
 
        {{ form.hidden_tag()}}
 
        <div class="form-group">
 
          {{ form.country(class_='form-control input-sm', onchange='this.form.submit()') }}
 
          <noscript>{{ form.submit(class_='btn btn-enn btn-sm') }}</noscript>
 
        </div>
 
      </form>
 
    </div>
 
  </div>
 
  <div class="col-md-8">
 
    <h2>General</h2>
 
    <p>Please mail all general inquiries to:</p>
 
    <address>
 
      <strong>Frënn vun der Ënn, ASBL</strong><br>
 
        BPM 381892<br>
 
        {{ address['address'] }}<br>
 
        {{ address['postal_code'] }}, {{ address['city'] }}<br>
 
        {{ address['country'] }}<br>
 
        {{ config['ENNSTATUS_ADDRESS'] }}<br>
 
        {{ config['ENNSTATUS_POSTAL_CODE'] }}, {{ config['ENNSTATUS_CITY'] }}<br>
 
        {{ config['ENNSTATUS_COUNTRY'] }}<br>
 
        <br>
 
      <abbr title="E-Mail"><span class="glyphicon glyphicon-envelope"></span></abbr> : <a href="mailto:info@enn.lu">info@enn.lu</a> <span class="glyphicon glyphicon-lock"></span> GPG: <a href="http://keyserver.cypherpunk.lu:11371/pks/lookup?search=info@enn.lu&op=vindex" target="_blank">0x02225522</a><br>
 
      <abbr title="Website"><span class="glyphicon glyphicon-cloud"></span></abbr> : <a href="//enn.lu/">enn.lu/</a> <strong>or</strong> <a href="//{{ config['ENNSTATUS_ONION_ADDRESS'] }}/" target="_blank">{{ config['ENNSTATUS_ONION_ADDRESS'] }}</a><br>
setup.py
Show inline comments
 
@@ -11,7 +11,7 @@ def _get_requirements():
 

	
 

	
 
setup(name='Ennstatus',
 
      version='5.4.7-dev',
 
      version='5.5.0',
 
      description=('Ennstatus provides the user with vital information about '
 
                   'the status of the organizations Tor servers.'),
 
      author='Frënn vun der Ënn',
0 comments (0 inline, 0 general)