incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [23/28] git commit: [#2835] ticket:304 Change url_paginated to respect attached artifact
Date Wed, 24 Apr 2013 17:16:32 GMT
[#2835] ticket:304 Change url_paginated to respect attached artifact


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

Branch: refs/heads/db/2835
Commit: ba9ea5dfcd75143213eb4e3a249d4bd2ba33c2da
Parents: eb43a31
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Thu Apr 4 09:45:55 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Apr 24 16:34:43 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/discuss.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ba9ea5df/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index e3cf591..fe79820 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -32,7 +32,7 @@ from allura.lib import helpers as h
 from allura.lib import security
 from allura.lib.security import require_access, has_access
 from allura.model.notification import Notification, Mailbox
-from .artifact import Artifact, VersionedArtifact, Snapshot, Message, Feed
+from .artifact import Artifact, ArtifactReference, VersionedArtifact, Snapshot, Message,
Feed
 from .attachments import BaseAttachment
 from .auth import User
 from .timeline import ActivityObject
@@ -556,7 +556,11 @@ class Post(Message, VersionedArtifact, ActivityObject):
             page = find_i(posts) / limit
 
         slug = h.urlquote(self.slug)
-        url = self.thread.url()
+        aref = ArtifactReference.query.get(_id=self.thread.ref_id)
+        if aref and aref.artifact:
+            url = aref.artifact.url()
+        else:
+            url = self.thread.url()
         if page == 0:
             return '%s?limit=%s#%s' % (url, limit, slug)
         return '%s?limit=%s&page=%s#%s' % (url, limit, page, slug)


Mime
View raw message