Compatibility fixes for newer versions of Jinja2 (e.g. 2.9.5+). Fixes #2156

This commit is contained in:
Murtuza Zabuawala 2017-02-06 12:53:16 +00:00 committed by Dave Page
parent c96da34c28
commit ec93077040
2 changed files with 4 additions and 4 deletions

View File

@ -518,8 +518,8 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
// First - register the menus from the other // First - register the menus from the other
// modules/extensions. // modules/extensions.
if (counter.total == counter.loaded) { if (counter.total == counter.loaded) {
{% for key in ('File', 'Edit', 'Object' 'Tools', 'Management', 'Help') %}{% set menu_items = current_app.menu_items['%s_items' % key.lower()] %}{% if menu_items|length > 0 %}{% set hasMenus = False %} {% for key in ('File', 'Edit', 'Object' 'Tools', 'Management', 'Help') %}
obj.add_menus([{% for item in menu_items %}{% if hasMenus %},{% endif %}{ obj.add_menus([{% for item in current_app.menu_items['%s_items' % key.lower()] %}{% if loop.index != 1 %}, {% endif %}{
name: "{{ item.name }}", name: "{{ item.name }}",
{% if item.module %}module: {{ item.module }}, {% if item.module %}module: {{ item.module }},
{% endif %}{% if item.url %}url: "{{ item.url }}", {% endif %}{% if item.url %}url: "{{ item.url }}",
@ -532,7 +532,7 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
priority: {{ item.priority }}, priority: {{ item.priority }},
enable: '{{ item.enable }}' enable: '{{ item.enable }}'
}{% set hasMenus = True %}{% endfor %}]); }{% set hasMenus = True %}{% endfor %}]);
{% endif %}{% endfor %} {% endfor %}
obj.create_menus(); obj.create_menus();
} else { } else {
// recall after some time // recall after some time

View File

@ -152,7 +152,7 @@
} }
}{% for script in current_app.javascripts %}{% if 'deps' in script or 'exports' in script %}, }{% for script in current_app.javascripts %}{% if 'deps' in script or 'exports' in script %},
'{{ script.name }}': { '{{ script.name }}': {
{% if 'deps' in script %}"deps": [ {% set comma = False %}{% for dep in script['deps'] %} {% if comma %},{% else %}{% set comma = True %}{% endif %} '{{ dep }}'{% endfor %}],{% endif %} {% if 'deps' in script %}"deps": [{% for dep in script['deps'] %} {% if loop.index != 1 %}, {% endif %} '{{ dep }}'{% endfor %}],{% endif %}
{% if 'exports' in script %}"exports": "{{ script['exports'] }}"{% endif %} {% if 'exports' in script %}"exports": "{{ script['exports'] }}"{% endif %}
}{% endif %}{% endfor %} }{% endif %}{% endfor %}
}, },