You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2023/03/24 14:56:58 UTC

[allura] branch db/6556mar2023 created (now b815cb474)

This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a change to branch db/6556mar2023
in repository https://gitbox.apache.org/repos/asf/allura.git


      at b815cb474 [#6556] fix many jinja undefined usages

This branch includes the following new commits:

     new b815cb474 [#6556] fix many jinja undefined usages

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[allura] 01/01: [#6556] fix many jinja undefined usages

Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch db/6556mar2023
in repository https://gitbox.apache.org/repos/asf/allura.git

commit b815cb474f5a5e84ad02cd5a411ff82cfec5098d
Author: Dave Brondsema <db...@slashdotmedia.com>
AuthorDate: Wed Mar 22 15:41:08 2023 -0400

    [#6556] fix many jinja undefined usages
---
 Allura/allura/templates/jinja_master/lib.html      |  2 +-
 Allura/allura/templates/jinja_master/master.html   | 20 +++++++++---------
 .../templates/jinja_master/sidebar_menu.html       |  2 +-
 .../templates/jinja_master/theme_macros.html       | 22 ++++++++++----------
 .../templates_responsive/jinja_master/master.html  | 16 +++++++--------
 .../jinja_master/sidebar_menu.html                 |  2 +-
 .../jinja_master/theme_macros.html                 | 24 +++++++++++-----------
 7 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/Allura/allura/templates/jinja_master/lib.html b/Allura/allura/templates/jinja_master/lib.html
index 9e1d34872..598d7cf6d 100644
--- a/Allura/allura/templates/jinja_master/lib.html
+++ b/Allura/allura/templates/jinja_master/lib.html
@@ -48,7 +48,7 @@
   {% endif %}
 {%- endmacro %}
 
-{% macro gravatar(user, size, className, gravatar_default_url=None) -%}
+{% macro gravatar(user, size, className=None, gravatar_default_url=None) -%}
   {% set display_name = h.really_unicode(user.display_name) %}
   {% set icon_url, user_proj, icon_source = user.icon_url(gravatar_default_url, return_more=True) %}
   {% if icon_url %}
diff --git a/Allura/allura/templates/jinja_master/master.html b/Allura/allura/templates/jinja_master/master.html
index 8562130a3..b6f2d8828 100644
--- a/Allura/allura/templates/jinja_master/master.html
+++ b/Allura/allura/templates/jinja_master/master.html
@@ -59,7 +59,7 @@
         <style type="text/css">
             {{c.project.neighborhood.get_custom_css()|safe}}
         </style>
-    {% elif neighborhood and neighborhood.css %}
+    {% elif neighborhood|default and neighborhood.css %}
         <style type="text/css">
             {{neighborhood.get_custom_css()}}
         </style>
@@ -85,11 +85,11 @@
 
 {% set flash = tg.flash_obj.render('flash', use_js=False) %}
 
-{% call theme_macros.all_content_wrapper(login_url, logout_url) %}
-    {{ theme_macros.header(g.login_url, '/auth/logout') }}
+{% call theme_macros.all_content_wrapper(g.login_url, g.logout_url) %}
+    {{ theme_macros.header(g.login_url, g.logout_url) }}
     {{ theme_macros.site_notification() }}
     {% block masthead %}{% endblock %}
-    <section id="page-body" class="{{ g.document_class(neighborhood) }} {% block page_body_classes %}{% endblock %}">
+    <section id="page-body" class="{{ g.document_class(neighborhood|default) }} {% block page_body_classes %}{% endblock %}">
         <div id="nav_menu_holder">
             {% if c.project and c.project.is_nbhd_project %}
                 {% set neighborhood=c.project.neighborhood %}
@@ -107,7 +107,7 @@
         </div>
         <div id="content_base">
             {% block content_base %}
-                {% if not hide_left_bar %}
+                {% if not hide_left_bar|default %}
                     {% block sidebar_menu %}
                         {% include g.theme.sidebar_menu %}
                     {% endblock %}
@@ -115,7 +115,7 @@
                 {% else %}
                     {% set outer_width = 24 %}
                 {% endif %}
-                {% if show_right_bar %}
+                {% if show_right_bar|default %}
                     {% set inner_width = outer_width - 8 %}
                 {% else %}
                     {% set inner_width = outer_width %}
@@ -130,12 +130,12 @@
                         <!-- /actions -->
                     </h2>
                     {% block edit_box %}{% endblock %}
-                    <div{% if show_right_bar %}
+                    <div{% if show_right_bar|default %}
                         class="{% block inner_grid scoped %}grid-{{ inner_width }}{% endblock %}"{% endif %}>
                         {% block before_content %}{% endblock %}
                         {% block content %}{% endblock %}
                     </div>
-                    {% if show_right_bar %}
+                    {% if show_right_bar|default %}
                         <div id="sidebar-right" class="grid-6 fright">
                             {% block right_content %}{% endblock %}
                         </div>
@@ -156,7 +156,7 @@
         </section>
     {% endfor %}
 </div>
-{% if c.show_login_overlay %}
+{% if c.show_login_overlay|default %}
     {{ theme_macros.login_overlay() }}
 {% endif %}
 {% for blob in g.resource_manager.emit('body_js') %}
@@ -166,7 +166,7 @@
     {{ blob }}
 {% endfor %}
 {% block extra_js %}{% endblock %}
-{% if neighborhood %}
+{% if neighborhood|default %}
     {{ neighborhood.site_specific_html | safe }}
 {% elif c.project.neighborhood %}
     {{ c.project.neighborhood.site_specific_html | safe }}
diff --git a/Allura/allura/templates/jinja_master/sidebar_menu.html b/Allura/allura/templates/jinja_master/sidebar_menu.html
index e7ed0e797..11007ffb9 100644
--- a/Allura/allura/templates/jinja_master/sidebar_menu.html
+++ b/Allura/allura/templates/jinja_master/sidebar_menu.html
@@ -55,7 +55,7 @@
   {% else %}
     <div class="placeholder-no-searchbox">&nbsp;</div>
   {% endif %}
-    {% if c.custom_sidebar_menu %}
+    {% if c.custom_sidebar_menu|default %}
       {% for s in c.custom_sidebar_menu %}
         {{sidebar_item(s)}}
       {% endfor %}
diff --git a/Allura/allura/templates/jinja_master/theme_macros.html b/Allura/allura/templates/jinja_master/theme_macros.html
index 01e2eb97b..e06f5d7a2 100644
--- a/Allura/allura/templates/jinja_master/theme_macros.html
+++ b/Allura/allura/templates/jinja_master/theme_macros.html
@@ -23,7 +23,7 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
 #}
 
 
-{%  if not header %}
+{% if header is undefined %}
 {%- macro header(login_url, logout_url) %}
 <header id="site-header">
     <div class="wrapper">
@@ -55,14 +55,14 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
 {% endif %}
 
 
-{% if not all_content_wrapper %}
+{% if all_content_wrapper is undefined %}
 {% macro all_content_wrapper(login_url, logout_url) -%}
 {{- caller(**kwargs) -}}
 {%- endmacro %}
 {% endif %}
 
 
-{% if not footer %}
+{% if footer is undefined %}
 {%- macro footer(year, path_to_static='') %}
 <footer id="site-footer">
   <nav>
@@ -72,13 +72,13 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
 {%- endmacro %}
 {% endif %}
 
-{% if not custom_js %}
+{% if custom_js is undefined %}
 {%- macro custom_js(path_to_static) %}
 
 {%- endmacro %}
 {% endif %}
 
-{% if not custom_tracking_js %}
+{% if custom_tracking_js is undefined %}
 {%- macro custom_tracking_js(accounts, user, project) %}
 <script type="text/javascript">
     {# This should be overridden in your custom theme (e.g., sftheme) to implement custom tracking code. #}
@@ -114,13 +114,13 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
 {%- endmacro %}
 {% endif %}
 
-{% if not extra_header %}
+{% if extra_header is undefined %}
 {%- macro extra_header(path_to_static) %}
 
 {%- endmacro %}
 {% endif %}
 
-{% if not breadcrumbs %}
+{% if breadcrumbs is undefined %}
 {%- macro breadcrumbs(project, app) %}
     <nav id="breadcrumbs">
         <ul>
@@ -139,7 +139,7 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
     </nav>
 {%- endmacro %}
 {% endif %}
-{% if not project_header_right %}
+{% if project_header_right is undefined %}
 {%- macro project_header_right(project, app) %}
   {% if project.neighborhood.icon %}
   <div class="neighborhood_block">
@@ -160,7 +160,7 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
 {%- endmacro %}
 {% endif %}
 
-{% if not login_overlay %}
+{% if login_overlay is undefined %}
 {%- macro login_overlay() %}
     {% do g.register_js('js/jquery.lightbox_me.js') %}
     {% do g.register_forge_js('js/jquery-ui-1.13.2.min.js') %}
@@ -172,7 +172,7 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
 {%- endmacro %}
 {% endif %}
 
-{% if not site_notification %}
+{% if site_notification is undefined %}
 {%- macro site_notification() %}
     {% set note = g.theme.get_site_notification() %}
     {% if note %}
@@ -186,7 +186,7 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
 {%- endmacro %}
 {% endif %}
 
-{% if not placeholder_project_icon %}
+{% if placeholder_project_icon is undefined %}
 {%- macro placeholder_project_icon() %}
     <div class="placeholder-icon"></div>
 {%- endmacro %}
diff --git a/Allura/allura/templates_responsive/jinja_master/master.html b/Allura/allura/templates_responsive/jinja_master/master.html
index 4656f3528..2083147dd 100644
--- a/Allura/allura/templates_responsive/jinja_master/master.html
+++ b/Allura/allura/templates_responsive/jinja_master/master.html
@@ -61,7 +61,7 @@
         <style type="text/css">
             {{c.project.neighborhood.get_custom_css()|safe}}
         </style>
-    {% elif neighborhood and neighborhood.css %}
+    {% elif neighborhood|default and neighborhood.css %}
         <style type="text/css">
             {{neighborhood.get_custom_css()}}
         </style>
@@ -87,11 +87,11 @@
 
 {% set flash = tg.flash_obj.render('flash', use_js=False) %}
 
-{% call theme_macros.all_content_wrapper(g.login_url, '/auth/logout') %}
-    {{ theme_macros.header(g.login_url, '/auth/logout') }}
+{% call theme_macros.all_content_wrapper(g.login_url, g.logout_url) %}
+    {{ theme_macros.header(g.login_url, g.logout_url) }}
     {{ theme_macros.site_notification() }}
     {% block masthead %}{% endblock %}
-    <section id="page-body" class="{{ g.document_class(neighborhood) }} {% block page_body_classes %}{% endblock %}">
+    <section id="page-body" class="{{ g.document_class(neighborhood|default) }} {% block page_body_classes %}{% endblock %}">
         {% if c.project and c.project.is_nbhd_project %}
             {% set neighborhood=c.project.neighborhood %}
             {% include 'allura:templates_responsive/jinja_master/neigh_nav_menu.html' with context %}
@@ -105,7 +105,7 @@
         {% endblock %}
         <div id="content_base" class="row">
             {% block content_base %}
-                {% if not hide_left_bar %}
+                {% if not hide_left_bar|default %}
                     {% block sidebar_menu %}
                         {% include g.theme.sidebar_menu %}
                     {% endblock %}
@@ -124,7 +124,7 @@
                         {% block before_content %}{% endblock %}
                         {% block content %}{% endblock %}
                     </div>
-                    {% if show_right_bar %}
+                    {% if show_right_bar|default %}
                         <div class="columns">
                             {% block right_content %}{% endblock %}
                         </div>
@@ -145,7 +145,7 @@
         </section>
     {% endfor %}
 </div>
-{% if c.show_login_overlay %}
+{% if c.show_login_overlay|default %}
     {{ theme_macros.login_overlay() }}
 {% endif %}
 {% for blob in g.resource_manager.emit('body_js') %}
@@ -155,7 +155,7 @@
     {{ blob }}
 {% endfor %}
 {% block extra_js %}{% endblock %}
-{% if neighborhood %}
+{% if neighborhood|default %}
     {{ neighborhood.site_specific_html | safe }}
 {% elif c.project.neighborhood %}
     {{ c.project.neighborhood.site_specific_html | safe }}
diff --git a/Allura/allura/templates_responsive/jinja_master/sidebar_menu.html b/Allura/allura/templates_responsive/jinja_master/sidebar_menu.html
index 5323bb1da..a60502478 100644
--- a/Allura/allura/templates_responsive/jinja_master/sidebar_menu.html
+++ b/Allura/allura/templates_responsive/jinja_master/sidebar_menu.html
@@ -55,7 +55,7 @@
   {% else %}
     <div class="placeholder-no-searchbox">&nbsp;</div>
   {% endif %}
-    {% if c.custom_sidebar_menu %}
+    {% if c.custom_sidebar_menu|default %}
       {% for s in c.custom_sidebar_menu %}
         {{sidebar_item(s)}}
       {% endfor %}
diff --git a/Allura/allura/templates_responsive/jinja_master/theme_macros.html b/Allura/allura/templates_responsive/jinja_master/theme_macros.html
index 1452e4352..5c639115d 100644
--- a/Allura/allura/templates_responsive/jinja_master/theme_macros.html
+++ b/Allura/allura/templates_responsive/jinja_master/theme_macros.html
@@ -24,7 +24,7 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
 
 
 {# account_links are used in primary nav, and off-canvas menu for small screens #}
-{% if not account_links %}
+{% if account_links is undefined %}
 {%- macro account_links(c, h, config, login_url, logout_url) %}
     {% if c.user._id %}
         <a href="/auth/preferences/">Account</a>
@@ -39,7 +39,7 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
 {%- endmacro %}
 {% endif %}
 
-{%  if not header %}
+{% if header is undefined %}
 {%- macro header(login_url, logout_url) %}
 {% set breakpoint='medium' %}
 <div class="row">
@@ -62,7 +62,7 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
 {% endif %}
 
 
-{% if not all_content_wrapper %}
+{% if all_content_wrapper is undefined %}
 {% macro all_content_wrapper(login_url, logout_url) -%}
     <div class="off-canvas position-right" id="offCanvas" data-off-canvas>
         <div class="menu vertical">
@@ -79,7 +79,7 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
 {% endif %}
 
 
-{% if not footer %}
+{% if footer is undefined %}
 {%- macro footer(year, path_to_static='') %}
 <footer id="site-footer" class="row align-right">
     <p>This project is powered by <a href="https://allura.apache.org/">Apache Allura</a>&trade;.</p>
@@ -87,7 +87,7 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
 {%- endmacro %}
 {% endif %}
 
-{% if not custom_js %}
+{% if custom_js is undefined %}
 {%- macro custom_js(path_to_static) %}
 <script>
     $(document).foundation();
@@ -95,7 +95,7 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
 {%- endmacro %}
 {% endif %}
 
-{% if not custom_tracking_js %}
+{% if custom_tracking_js is undefined %}
 {%- macro custom_tracking_js(accounts, user, project) %}
 <script type="text/javascript">
     {# This should be overridden in your custom theme (e.g., sftheme) to implement custom tracking code. #}
@@ -129,13 +129,13 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
 {%- endmacro %}
 {% endif %}
 
-{% if not extra_header %}
+{% if extra_header is undefined %}
 {%- macro extra_header(path_to_static) %}
 
 {%- endmacro %}
 {% endif %}
 
-{% if not breadcrumbs %}
+{% if breadcrumbs is undefined %}
 {%- macro breadcrumbs(project, app) %}
     <nav aria-label="You are here:" role="navigation" class="row">
         <ul class="breadcrumbs">
@@ -156,7 +156,7 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
 {% endif %}
 
 
-{% if not project_header_right %}
+{% if project_header_right is undefined %}
 {%- macro project_header_right(project, app) %}
   {% if project.neighborhood.icon %}
   <div class="column shrink neighborhood_block">
@@ -177,7 +177,7 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
 {%- endmacro %}
 {% endif %}
 
-{% if not login_overlay %}
+{% if login_overlay is undefined %}
 {%- macro login_overlay() %}
     {% do g.register_js('js/jquery.lightbox_me.js') %}
     {% do g.register_forge_js('js/jquery-ui-1.13.2.min.js') %}
@@ -189,7 +189,7 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
 {%- endmacro %}
 {% endif %}
 
-{% if not site_notification %}
+{% if site_notification is undefined %}
 {%- macro site_notification() %}
     {% set note = g.theme.get_site_notification() %}
     {% if note %}
@@ -206,7 +206,7 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
 {%- endmacro %}
 {% endif %}
 
-{% if not placeholder_project_icon %}
+{% if placeholder_project_icon is undefined %}
 {%- macro placeholder_project_icon() %}
     <div class="placeholder-icon"></div>
 {%- endmacro %}