diff options
Diffstat (limited to '')
-rw-r--r-- | app/forms.py | 4 | ||||
-rw-r--r-- | app/login.py | 2 | ||||
-rw-r--r-- | app/utils.py | 4 | ||||
-rw-r--r-- | app/views/__init__.py | 2 | ||||
-rw-r--r-- | app/views/categories.py | 2 | ||||
-rw-r--r-- | app/views/consts.py | 22 | ||||
-rw-r--r-- | app/views/expenses.py | 22 | ||||
-rw-r--r-- | app/views/stats.py | 2 | ||||
-rw-r--r-- | app/views/user.py | 18 | ||||
-rw-r--r-- | fixers.py | 2 | ||||
-rwxr-xr-x | manage.py | 2 | ||||
-rw-r--r-- | migrations/env.py | 2 |
12 files changed, 42 insertions, 42 deletions
diff --git a/app/forms.py b/app/forms.py index cdd801f..b0d5339 100644 --- a/app/forms.py +++ b/app/forms.py @@ -25,11 +25,11 @@ class Form(_Form): locales = ['de_DE', 'de'] def __init__ (self, *args, **kwargs): - self._msg = kwargs.pop('flash', u"Fehler im Formular!") + self._msg = kwargs.pop('flash', "Fehler im Formular!") _Form.__init__(self, *args, **kwargs) def flash(self): - flask.flash(self._msg, u'error') + flask.flash(self._msg, 'error') def flash_validate (self): if not self.validate(): diff --git a/app/login.py b/app/login.py index 93b4a9d..c798993 100644 --- a/app/login.py +++ b/app/login.py @@ -7,7 +7,7 @@ from flask.ext.login import login_user, logout_user, login_required, current_use login_manager = LoginManager() login_manager.init_app(app) -login_manager.login_message = u"Bitte einloggen!" +login_manager.login_message = "Bitte einloggen!" class User (model.User, UserMixin): def check_password(self, pwd): diff --git a/app/utils.py b/app/utils.py index 9ee0cf1..73f2b51 100644 --- a/app/utils.py +++ b/app/utils.py @@ -101,7 +101,7 @@ def assert_authorisation(constructor, param): obj = constructor(p) if obj is None: - flash(u"Eintrag existiert nicht!", u'error') + flash("Eintrag existiert nicht!", 'error') return redirect('index') if not hasattr(obj, 'user_id'): @@ -109,7 +109,7 @@ def assert_authorisation(constructor, param): # explicitly use user_id to avoid having to load the user object if obj.user_id != current_user.id: - flash(u"Nicht erlaubte Operation!", u'error') + flash("Nicht erlaubte Operation!", 'error') return redirect('index') else: return f(*args, **kwargs) diff --git a/app/views/__init__.py b/app/views/__init__.py index 38771ae..6b432e8 100644 --- a/app/views/__init__.py +++ b/app/views/__init__.py @@ -36,7 +36,7 @@ def static_url(s, **kwargs): @app.template_filter('eur') def eur(s): - return (u'%s EUR' % s) + return ('%s EUR' % s) @app.template_filter('date') def format_date(s, format='%Y/%m'): diff --git a/app/views/categories.py b/app/views/categories.py index ca9b828..47379ba 100644 --- a/app/views/categories.py +++ b/app/views/categories.py @@ -20,7 +20,7 @@ def manage(): return { 'cats' : categories } else: - for id, name in request.form.iteritems(): + for id, name in request.form.items(): if id.startswith('n-'): db.session.add(Category(name = name, user = current_user)) else: diff --git a/app/views/consts.py b/app/views/consts.py index 53616a4..c76cf17 100644 --- a/app/views/consts.py +++ b/app/views/consts.py @@ -25,28 +25,28 @@ def one_year(d): # Form # class ConstForm(F.Form): - start = F.DateField(u'Beginn', F.req, + start = F.DateField('Beginn', F.req, format='%m.%Y', default=lambda: today()) - end = F.DateField(u'Ende', F.req, + end = F.DateField('Ende', F.req, format='%m.%Y', default=lambda: one_year(today()), - description=u'(einschließlich)') + description='(einschließlich)') - months = F.IntegerField(u'Zahlungsrythmus', F.req, + months = F.IntegerField('Zahlungsrythmus', F.req, description='Monate') - expense = F.DecimalField(u'Betrag', F.req, - description=u'EUR', + expense = F.DecimalField('Betrag', F.req, + description='EUR', places=2) - description = F.StringField(u'Beschreibung', F.req) + description = F.StringField('Beschreibung', F.req) - category = F.QuerySelectField(u'Kategorie', + category = F.QuerySelectField('Kategorie', get_label='name') - prev = F.QuerySelectField(u'Vorgänger', + prev = F.QuerySelectField('Vorgänger', get_label='description', allow_blank=True) @@ -126,7 +126,7 @@ def edit(id): elif form.flash_validate(): # change form.populate_obj(exp) db.session.commit() - flash(u"Eintrag geändert.") + flash("Eintrag geändert.") return redirect('.show', id = id) return { 'form': form } @@ -146,7 +146,7 @@ def add(): exp.user = current_user db.session.add(exp) db.session.commit() - flash(u"Eintrag hinzugefügt.") + flash("Eintrag hinzugefügt.") return redirect('.show', id = exp.id) return { 'form': form } diff --git a/app/views/expenses.py b/app/views/expenses.py index 30a6830..c504881 100644 --- a/app/views/expenses.py +++ b/app/views/expenses.py @@ -19,17 +19,17 @@ mod = Blueprint('expenses', __name__) # Form # class ExpenseForm(F.Form): - date = F.DateField(u'Datum', F.req, + date = F.DateField('Datum', F.req, format="%d.%m.%Y", default=lambda: today()) - expense = F.DecimalField(u'Betrag', F.req, - description=u'EUR', + expense = F.DecimalField('Betrag', F.req, + description='EUR', places=2) - description = F.StringField(u'Beschreibung') + description = F.StringField('Beschreibung') - category = F.QuerySelectField(u'Kategorie', + category = F.QuerySelectField('Kategorie', get_label='name') def __init__(self, obj = None, description_req = True): @@ -76,7 +76,7 @@ def calc_month_and_pie(year, month): def entry_flash(msg, exp): """When changing/adding an entry, a message is shown.""" url = url_for('.edit', id = exp.id) - link = u"<a href=\"%s\">%s</a>" % (url, exp.description) + link = "<a href=\"%s\">%s</a>" % (url, exp.description) flash(Markup(msg % link)) # @@ -153,7 +153,7 @@ def edit(id): return { 'form': form } db.session.commit() - entry_flash(u"Eintrag %s geändert.", exp) + entry_flash("Eintrag %s geändert.", exp) return redirect('index') return { 'form': form } @@ -178,7 +178,7 @@ def add(): db.session.add(exp) db.session.commit() - entry_flash(u"Neuer Eintrag %s hinzugefügt.", exp) + entry_flash("Neuer Eintrag %s hinzugefügt.", exp) return redirect('.add') @@ -191,11 +191,11 @@ def search(): try: query = request.form['search'].strip() except KeyError: - flash(u"Ungültige Suchanfrage") + flash("Ungültige Suchanfrage") return redirect('index') if not query: - flash(u"Leere Suche") + flash("Leere Suche") return redirect('index') exps = SingleExpense.of(current_user).filter(SingleExpense.description.ilike(query))\ @@ -203,7 +203,7 @@ def search(): .all() if not exps: - flash(u"Keine Ergebnisse") + flash("Keine Ergebnisse") return redirect('index') return { 'exps': exps } diff --git a/app/views/stats.py b/app/views/stats.py index 639f73b..9ff81a1 100644 --- a/app/views/stats.py +++ b/app/views/stats.py @@ -45,7 +45,7 @@ def show(): consts[date_to_ms(cur)] += e.monthly cur = next_date(cur) - consts = list(sorted(consts.iteritems())) + consts = list(sorted(consts.items())) expQuery = SingleExpense.of(current_user)\ .group_by(SingleExpense.year, SingleExpense.month)\ diff --git a/app/views/user.py b/app/views/user.py index 2a8730d..9b75af8 100644 --- a/app/views/user.py +++ b/app/views/user.py @@ -14,9 +14,9 @@ mod = Blueprint('user', __name__) # Forms # class LoginForm(F.Form): - username = F.StringField(u'Username', F.req) - pwd = F.PasswordField(u'Passwort', F.req) - remember = F.BooleanField(u'Eingeloggt bleiben?') + username = F.StringField('Username', F.req) + pwd = F.PasswordField('Passwort', F.req) + remember = F.BooleanField('Eingeloggt bleiben?') def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -36,13 +36,13 @@ class LoginForm(F.Form): class ChangePwdForm(F.Form): - old = F.PasswordField(u'Passwort', F.req) - new = F.PasswordField(u'Neues Passwort', F.req + [F.validators.EqualTo('confirm', u'Passwörter stimmen nicht überein')]) - confirm = F.PasswordField(u'Wdh. neues Passwort', F.req) + old = F.PasswordField('Passwort', F.req) + new = F.PasswordField('Neues Passwort', F.req + [F.validators.EqualTo('confirm', 'Passwörter stimmen nicht überein')]) + confirm = F.PasswordField('Wdh. neues Passwort', F.req) def validate_old(self, field): if not current_user.check_password(field.data): - raise F.ValidationError(u"Falsches Passwort") + raise F.ValidationError("Falsches Passwort") @property def newpwd(self): @@ -55,7 +55,7 @@ class ChangePwdForm(F.Form): @templated def login(): """Log the user in.""" - form = LoginForm(flash=u"Login fehlgeschlagen!") + form = LoginForm(flash="Login fehlgeschlagen!") if form.validate_on_submit(): login_user(form.user, remember=form.remember.data) # we explicitly need flask's variant as we redirect to a URI @@ -80,7 +80,7 @@ def cpw(): if form.validate_on_submit(): current_user.set_password(form.newpwd) db.session.commit() - flash(u"Passwort geändert.") + flash("Passwort geändert.") return redirect('index') return { 'form': form } @@ -1,4 +1,4 @@ -from urllib import unquote +from urllib.parse import unquote from werkzeug.wrappers import BaseResponse as Response class ScriptNameFixer(object): @@ -3,7 +3,7 @@ import sys -from app import app, db +from .app import app, db from flask.ext.script import Manager from flask.ext.migrate import Migrate, MigrateCommand diff --git a/migrations/env.py b/migrations/env.py index 70961ce..0e050ce 100644 --- a/migrations/env.py +++ b/migrations/env.py @@ -1,4 +1,4 @@ -from __future__ import with_statement + from alembic import context from sqlalchemy import engine_from_config, pool from logging.config import fileConfig |