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
// modules/extensions.
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 %}
obj.add_menus([{% for item in menu_items %}{% if hasMenus %},{% endif %}{
{% for key in ('File', 'Edit', 'Object' 'Tools', 'Management', 'Help') %}
obj.add_menus([{% for item in current_app.menu_items['%s_items' % key.lower()] %}{% if loop.index != 1 %}, {% endif %}{
name: "{{ item.name }}",
{% if item.module %}module: {{ item.module }},
{% endif %}{% if item.url %}url: "{{ item.url }}",
@ -532,7 +532,7 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
priority: {{ item.priority }},
enable: '{{ item.enable }}'
}{% set hasMenus = True %}{% endfor %}]);
{% endif %}{% endfor %}
{% endfor %}
obj.create_menus();
} else {
// recall after some time

View File

@ -152,7 +152,7 @@
}
}{% for script in current_app.javascripts %}{% if 'deps' in script or 'exports' in script %},
'{{ 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 %}
}{% endif %}{% endfor %}
},