You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by ke...@apache.org on 2017/09/11 19:36:02 UTC

allura git commit: update jinja version; handle new jinja filter args and loop var scoping

Repository: allura
Updated Branches:
  refs/heads/master c22d78963 -> f64925421


update jinja version; handle new jinja filter args and loop var scoping


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/f6492542
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/f6492542
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/f6492542

Branch: refs/heads/master
Commit: f6492542122fbb724c273042311d275567cd82b3
Parents: c22d789
Author: Dave Brondsema <da...@brondsema.net>
Authored: Wed Sep 6 15:31:59 2017 -0400
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Wed Sep 6 16:30:08 2017 -0400

----------------------------------------------------------------------
 Allura/allura/model/repo_refresh.py                  | 10 ++++++++--
 Allura/allura/templates/mail/commits.md              |  4 +---
 ForgeWiki/forgewiki/templates/wiki/page_history.html |  4 +---
 ForgeWiki/forgewiki/tests/functional/test_root.py    |  2 +-
 requirements.txt                                     |  4 ++--
 5 files changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/f6492542/Allura/allura/model/repo_refresh.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index 327865c..99fda0b 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -385,7 +385,6 @@ def send_notifications(repo, commit_ids):
     from allura.model import Feed, Notification
     commit_msgs = []
     base_url = tg.config['base_url']
-    last_branch = []
     for oids in utils.chunked_iter(commit_ids, QSIZE):
         chunk = list(oids)
         index = dict(
@@ -422,6 +421,13 @@ def send_notifications(repo, commit_ids):
             c_msg['branches'] = prev_branch
         prev_branch = c_msg['branches']
 
+    # mark which ones are first on a branch and need the branch name shown
+    last_branch = None
+    for c_msg in commit_msgs:
+        if c_msg['branches'] != last_branch:
+            c_msg['show_branch_name'] = True
+        last_branch = c_msg['branches']
+
     if commit_msgs:
         if len(commit_msgs) > 1:
             subject = u"{} new commits to {}".format(len(commit_msgs), repo.app.config.options.mount_label)
@@ -444,7 +450,7 @@ def _title(message):
     if not message:
         return ''
     line = message.splitlines()[0]
-    return jinja2.filters.do_truncate(line, 200, True)
+    return jinja2.filters.do_truncate(None, line, 200, killwords=True, leeway=3)
 
 
 def _summarize(message):

http://git-wip-us.apache.org/repos/asf/allura/blob/f6492542/Allura/allura/templates/mail/commits.md
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/mail/commits.md b/Allura/allura/templates/mail/commits.md
index d4a1a96..1b1d043 100644
--- a/Allura/allura/templates/mail/commits.md
+++ b/Allura/allura/templates/mail/commits.md
@@ -17,11 +17,9 @@
        under the License.
 --> #}
 {%- for cm in commit_msgs[:max_num_commits] %}
-{%- if cm.branches and cm.branches != last_branch|default %}
+{%- if cm.branches and cm.show_branch_name|default %}
 ## Branch: {% for b in cm.branches %}{{ b }}  {% endfor%}
 {% endif %}
-{% set last_branch = cm.branches -%}
-
 {{ cm.summary }}
 
 By {{ cm.author }} on {{ cm.date }}

http://git-wip-us.apache.org/repos/asf/allura/blob/f6492542/ForgeWiki/forgewiki/templates/wiki/page_history.html
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/templates/wiki/page_history.html b/ForgeWiki/forgewiki/templates/wiki/page_history.html
index dc3027a..02f385d 100644
--- a/ForgeWiki/forgewiki/templates/wiki/page_history.html
+++ b/ForgeWiki/forgewiki/templates/wiki/page_history.html
@@ -43,7 +43,6 @@
       </tr>
     </thead>
     <tbody>
-      {% set i = 0 %}
       {% for p in pages %}
         <tr>
           <td>{{p.version}} by {{p.author.display_name}} ({{p.author.username}})</td>
@@ -51,7 +50,7 @@
           <td><input name="v1" type="radio" value="{{p.version}}"/></td>
           <td><input name="v2" type="radio" value="{{p.version}}"/></td>
           <td class="tright">
-            {% if i != 0 and h.has_access(p, 'edit')() %}
+            {% if not loop.first and h.has_access(p, 'edit')() %}
               {{ g.icons['revert'].render(
                   extra_css='post-link',
                   title='Revert to version {}'.format(p.version),
@@ -72,7 +71,6 @@
             {{ g.icons['eye'].render(href='./?version={}'.format(p.version), title='View Revision') }}
           </td>
         </tr>
-        {% set i = i+1 %}
       {% endfor %}
     </tbody>
   </table>

http://git-wip-us.apache.org/repos/asf/allura/blob/f6492542/ForgeWiki/forgewiki/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_root.py b/ForgeWiki/forgewiki/tests/functional/test_root.py
index c4590c7..5bcb4d5 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -243,7 +243,7 @@ class TestRootController(TestController):
         assert '2 by Test Admin' in response
         assert '1 by Test Admin' in response
         # you can revert to an old revison, but not the current one
-        assert response.html.find('a', {'data-dialog-id': '1'})
+        assert response.html.find('a', {'data-dialog-id': '1'}), response.html
         assert not response.html.find('a', {'data-dialog-id': '2'})
         response = self.app.get('/wiki/tést/history',
                                 extra_environ=dict(username='*anonymous'))

http://git-wip-us.apache.org/repos/asf/allura/blob/f6492542/requirements.txt
----------------------------------------------------------------------
diff --git a/requirements.txt b/requirements.txt
index ada3845..44349fc 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -19,7 +19,7 @@ html5lib==0.999
 # dep of oauth2
 httplib2==0.7.4
 iso8601==0.1.4
-Jinja2==2.8
+Jinja2==2.9.6
 Markdown==2.2.0
 Ming==0.5.5
 oauth2==1.5.170
@@ -66,7 +66,7 @@ pyasn1==0.1.9
 # tg2 deps (not used directly)
 Babel==1.3
 Mako==0.3.2
-MarkupSafe==0.15
+MarkupSafe==1.0
 Pylons==1.0
 simplejson==2.2.1
 Tempita==0.5.1