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 2020/01/28 15:12:18 UTC

[allura] 01/03: [#7878] activity rss feed unicode fixes

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

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

commit ee36931d6d53b43ba82b6108925d6029eb3e0e0d
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Mon Jan 27 18:35:24 2020 -0500

    [#7878] activity rss feed unicode fixes
---
 ForgeActivity/forgeactivity/main.py                       | 5 +++--
 ForgeActivity/forgeactivity/tests/functional/test_root.py | 7 +++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/ForgeActivity/forgeactivity/main.py b/ForgeActivity/forgeactivity/main.py
index 1e6ba97..33ce2e1 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -166,7 +166,8 @@ class ForgeActivityController(BaseController):
         else:
             feed = FG.Rss201rev2Feed(**d)
         for t in data['timeline']:
-            url = h.absurl(t.obj.activity_url.encode('utf-8'))
+            url_id = h.absurl(t.obj.activity_url)  # try to keep this consistent over time (not url-quoted)
+            url = h.absurl(h.urlquote_path_only(t.obj.activity_url))
             feed.add_item(title='%s %s %s%s' % (
                                 t.actor.activity_name,
                 t.verb,
@@ -176,7 +177,7 @@ class ForgeActivityController(BaseController):
                 link=url,
                 pubdate=t.published,
                 description=t.obj.activity_extras.get('summary'),
-                unique_id=url,
+                unique_id=url_id,
                 author_name=t.actor.activity_name,
                 author_link=h.absurl(t.actor.activity_url))
         return feed.writeString('utf-8')
diff --git a/ForgeActivity/forgeactivity/tests/functional/test_root.py b/ForgeActivity/forgeactivity/tests/functional/test_root.py
index faaac4d..751f515 100644
--- a/ForgeActivity/forgeactivity/tests/functional/test_root.py
+++ b/ForgeActivity/forgeactivity/tests/functional/test_root.py
@@ -1,3 +1,4 @@
+# coding=utf-8
 #       Licensed to the Apache Software Foundation (ASF) under one
 #       or more contributor license agreements.  See the NOTICE file
 #       distributed with this work for additional information
@@ -192,7 +193,7 @@ class TestActivityController(TestController):
                 "activity_extras": {
                     "summary": "Just wanted to leave a comment on this..."
                 },
-                "activity_url": "/p/test/tickets/34/?limit=25#ed7c",
+                "activity_url": "/p/test/unicode•º/?limit=25#ed7c",
                 "activity_name": "a comment"
             },
             "target": {
@@ -228,8 +229,10 @@ class TestActivityController(TestController):
                      'Administrator 1 posted a comment on ticket #34')
         assert_equal(activity.find('description').text,
                      'Just wanted to leave a comment on this...')
+        assert_equal(activity.find('guid').text,
+                     'http://localhost/p/test/unicode•º/?limit=25#ed7c')
         assert_equal(activity.find('link').text,
-                     'http://localhost/p/test/tickets/34/?limit=25#ed7c')
+                     'http://localhost/p/test/unicode%E2%80%A2%C2%BA/?limit=25#ed7c')
 
     @td.with_tool('test', 'activity')
     @patch('forgeactivity.main.g.director')