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 2013/05/17 00:30:34 UTC

[43/50] [abbrv] git commit: [#5644] ticket:332 Fix guid for repo feeds

[#5644] ticket:332 Fix guid for repo feeds


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

Branch: refs/heads/db/6208
Commit: 3e45f5de9ec9cd8b632222f856a24c99b92d1a2a
Parents: 63b4e59
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri May 10 13:24:33 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed May 15 19:23:47 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/artifact.py                    |   11 ++++++-----
 Allura/allura/model/repo_refresh.py                |    3 ++-
 .../forgegit/tests/functional/test_controllers.py  |    1 +
 3 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3e45f5de/Allura/allura/model/artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index 2acd9d8..4a7f2c1 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -388,7 +388,7 @@ class VersionedArtifact(Artifact):
         session(ss).insert_now(ss, state(ss))
         log.info('Snapshot version %s of %s',
                  self.version, self.__class__)
-        if update_stats: 
+        if update_stats:
             if self.version > 1:
                 g.statsUpdater.modifiedArtifact(
                     self.type_s, self.mod_date, self.project, c.user)
@@ -644,7 +644,7 @@ class Feed(MappedClass):
 
 
     @classmethod
-    def post(cls, artifact, title=None, description=None, author=None, author_link=None, author_name=None, pubdate=None, link=None):
+    def post(cls, artifact, title=None, description=None, author=None, author_link=None, author_name=None, pubdate=None, link=None, **kw):
         """
         Create a Feed item.  Returns the item.
         But if anon doesn't have read access, create does not happen and None is returned
@@ -666,10 +666,8 @@ class Feed(MappedClass):
         if description is None: description = title
         if pubdate is None:
             pubdate = datetime.utcnow()
-
         if link is None:
             link=artifact.url()
-
         item = cls(
             ref_id=artifact.index_id(),
             neighborhood_id=artifact.app_config.project.neighborhood_id,
@@ -682,6 +680,9 @@ class Feed(MappedClass):
             pubdate=pubdate,
             author_name=author_name,
             author_link=author_link or author.url())
+        unique_id = kw.pop('unique_id', None)
+        if unique_id:
+            item.unique_id = unique_id
         return item
 
     @classmethod
@@ -709,7 +710,7 @@ class Feed(MappedClass):
                           link=h.absurl(r.link.encode('utf-8')),
                           pubdate=r.pubdate,
                           description=r.description,
-                          unique_id=r.unique_id,
+                          unique_id=h.absurl(r.unique_id),
                           author_name=r.author_name,
                           author_link=h.absurl(r.author_link))
         return feed

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3e45f5de/Allura/allura/model/repo_refresh.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index 58a5411..3d5f08b 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -408,7 +408,8 @@ def send_notifications(repo, commit_ids):
                     summary, href),
                 author_link=ci.author_url,
                 author_name=ci.authored.name,
-                link=href)
+                link=href,
+                unique_id=href)
             branches = repo.symbolics_for_commit(ci)[0]
             commit_msgs.append('%s: %s by %s %s%s' % (
                     ",".join(b for b in branches),

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3e45f5de/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index 11cf6aa..0552f8a 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -179,6 +179,7 @@ class TestRootController(_TestCase):
             assert_equal(commit.find('title').text, 'Initial commit')
             link = 'http://localhost:80/p/test/src-git/ci/9a7df788cf800241e3bb5a849c8870f2f8259d98/'
             assert_equal(commit.find('link').text, link)
+            assert_equal(commit.find('guid').text, link)
         # .atom has slightly different structure
         prefix = '{http://www.w3.org/2005/Atom}'
         r = self.app.get('/src-git/feed.atom')