summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarian Sigler <m@qjym.de>2012-09-24 03:34:46 +0200
committerMarian Sigler <m@qjym.de>2012-09-24 03:34:46 +0200
commit9c2ce8952287cc626cb8babad2a9ad23098b0c24 (patch)
tree6a7e375170ff9719c8625e62ddc05d46ba71a360
parent9606704fa0ae06835142d2a67ada661ef203b0c6 (diff)
downloadweb-9c2ce8952287cc626cb8babad2a9ad23098b0c24.tar.gz
web-9c2ce8952287cc626cb8babad2a9ad23098b0c24.tar.bz2
web-9c2ce8952287cc626cb8babad2a9ad23098b0c24.zip
templates/_macros: move errors in own macro
-rw-r--r--account.py2
-rw-r--r--templates/_macros.html26
-rw-r--r--templates/register.html1
3 files changed, 16 insertions, 13 deletions
diff --git a/account.py b/account.py
index 734ff1d..e037240 100644
--- a/account.py
+++ b/account.py
@@ -17,7 +17,7 @@ class AccountService:
its own authentication request (bind).
To test you stuff against our test setup use Port-Forwarding
- ssh spline -L 5678:vm-acocunt:389 -N
+ ssh spline -L 5678:vm-account:389 -N
* register a new user
>> service = AccountService(LDAP_HOST, LDAP_BASE_DN, ADMIN_USER, ADMIN_PW, SERVICES)
diff --git a/templates/_macros.html b/templates/_macros.html
index 8298040..265584f 100644
--- a/templates/_macros.html
+++ b/templates/_macros.html
@@ -3,17 +3,21 @@
{{ field.label }}
<div class="controls">
{{ field(**kwargs)|safe }}
- {%- if field.errors|length == 1 %}
- <div class="errors">
- {{ field.errors.0 }}
- </div>
- {% elif field.errors %}
- <ul class="errors">
- {% for error in field.errors %}
- <li>{{ error }}</li>
- {% endfor %}
- </ul>
- {% endif %}
+ {{ render_errors(field.errors) }}
</div>
</div>
{%- endmacro %}
+
+{% macro render_errors(errors) %}
+ {%- if errors|length == 1 %}
+ <div class="errors">
+ {{ errors.0 }}
+ </div>
+ {% elif errors %}
+ <ul class="errors">
+ {% for error in errors %}
+ <li>{{ error }}</li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+{%- endmacro %}
diff --git a/templates/register.html b/templates/register.html
index cdd101d..ab785ea 100644
--- a/templates/register.html
+++ b/templates/register.html
@@ -4,7 +4,6 @@
{%- set no_login_message = true %}
{%- block content %}
<form action="{{ url_for('register') }}" method="post" class="form-horizontal">
- {{ form.errors }}
{{ render_field(form.username) }}
{{ render_field(form.mail) }}
{{ form.csrf_token }}