summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2013-04-16 00:21:01 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2013-04-16 00:21:01 +0200
commitb9b9200795b9fe7f6d054f117934e179a44f0224 (patch)
treea01181e454b49f18fb9d04de471591953c281a9f /app
parent02172e39c15272f9567bd39a28ec24d0270ea70f (diff)
downloadkosten-b9b9200795b9fe7f6d054f117934e179a44f0224.tar.gz
kosten-b9b9200795b9fe7f6d054f117934e179a44f0224.tar.bz2
kosten-b9b9200795b9fe7f6d054f117934e179a44f0224.zip
Fix templated
Diffstat (limited to '')
-rw-r--r--app/utils.py14
-rw-r--r--app/views/consts.py2
-rw-r--r--app/views/expenses.py2
3 files changed, 12 insertions, 6 deletions
diff --git a/app/utils.py b/app/utils.py
index caacea7..67b4897 100644
--- a/app/utils.py
+++ b/app/utils.py
@@ -2,14 +2,20 @@ from functools import wraps
from flask import request, render_template, url_for
from flask import redirect as _redirect
+def _gen_tpl(endpoint):
+ return endpoint.replace('.', '/') + '.jinja'
+
def templated(template=None):
def decorator(f):
@wraps(f)
def decorated_function(*args, **kwargs):
- template_name = template
- if template_name is None:
- template_name = request.endpoint \
- .replace('.', '/') + '.jinja'
+ if template is None:
+ template_name = _gen_tpl(request.endpoint)
+ elif template[0] == '.' and request.blueprint is not None:
+ template_name = _gen_tpl(request.blueprint + template)
+ else:
+ template_name = template
+
ctx = f(*args, **kwargs)
if ctx is None:
ctx = {}
diff --git a/app/views/consts.py b/app/views/consts.py
index 441137d..6200bfa 100644
--- a/app/views/consts.py
+++ b/app/views/consts.py
@@ -75,7 +75,7 @@ def edit(id):
return { 'form': form }
@mod.route("/add/from/<int:other>")
-@templated("add")
+@templated(".add")
def add_from(other):
exp = ConstExpense() # needed to initialize 'CE.next'
diff --git a/app/views/expenses.py b/app/views/expenses.py
index c0d9c65..57a777a 100644
--- a/app/views/expenses.py
+++ b/app/views/expenses.py
@@ -46,7 +46,7 @@ def is_last(exp):
return exp.date >= datetime.date.today().replace(day = 1)
@mod.route("/<int(fixed_digits=4):year>/<int(fixed_digits=2):month>")
-@templated("show")
+@templated(".show")
def show_date(year, month):
c = calc_month_exp(year, month)
return { 'exps' : [c] }
enfeld1-1/+1 2012-09-06Use --noreport instead of head -n -2 for tree so that it works on mac.Jason A. Donenfeld1-1/+1 Reported-by: Theo Belaire <tbelaire@uwaterloo.ca> 2012-09-05Be sure to explicitly state that install is a phony target.Jason A. Donenfeld1-0/+2 2012-09-05Bump debian version horribly.1.1Jason A. Donenfeld2-2/+2 2012-09-04No echo mode.Jason A. Donenfeld2-16/+42 Add a --no-echo flag to the insert operation so that the password isn't echoed when entering it. This requires the user to echo the password twice for confirmation. Reported-by: Dominic Lüchinger <d.luechinger@snowgarden.ch> 2012-09-04Properly quote the path too.Jason A. Donenfeld1-1/+1 2012-09-04Allow passwords having spaces to go unbroken to the clipboard.Bernardo Freitas Paulo da Costa1-1/+1 This also prevents showing the second <word> of the password in the prompt. 2012-09-04Separate out the massive git example.Jason A. Donenfeld1-10/+14 2012-09-04Prepare for debianification.1.0Jason A. Donenfeld9-4/+60 2012-09-03Fix readme typo.Jason A. Donenfeld1-1/+1 2012-09-03Show program name properly in error message.Jason A. Donenfeld1-1/+1 2012-09-03Move examples into manpage.Jason A. Donenfeld4-93/+224 2012-09-03Make into a real project.Jason A. Donenfeld8-5/+173 2012-09-03Support pass gitJason A. Donenfeld2-1/+15 2012-08-31Add remove synonyms.Jason A. Donenfeld1-2/+2 2012-08-31Use basename in usage.Jason A. Donenfeld1-2/+1 2012-08-19now using gpg_id as a varMatthew Ramirez1-2/+2 2012-08-07Forty five seconds.Jason A. Donenfeld1-1/+1 2012-08-06Deal with klipper and new lines.Jason A. Donenfeld1-3/+19 2012-08-06Update examples.Jason A. Donenfeld1-7/+7 2012-08-06Update readme.Jason A. Donenfeld1-11/+13 2012-08-06Be slicker and more like git.Jason A. Donenfeld1-114/+173