incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [37/49] git commit: [#5286] Skip orphaned blog posts in nbhd blog posts macro
Date Fri, 07 Dec 2012 22:26:36 GMT
[#5286] Skip orphaned blog posts in nbhd blog posts macro

- If a blog posts app has been deleted, but the post still
  exists in mongo, technically it's deleted anyway, and
  shouldn't be included in the macro output.

- This is a side-effect of old code that didn't clean up artifacts
  properly on tool deletion. The code as it is today *does*
  delete artifacts when the tool is deleted.


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

Branch: refs/heads/db/4803
Commit: f5a220f81ad6efd2505bef2c07a195fe9ffbfc97
Parents: cb6a9e3
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Tue Nov 27 22:59:54 2012 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Mon Dec 3 20:24:20 2012 +0000

----------------------------------------------------------------------
 Allura/allura/lib/macro.py      |    3 ++-
 Allura/allura/model/artifact.py |    2 ++
 2 files changed, 4 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f5a220f8/Allura/allura/lib/macro.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/macro.py b/Allura/allura/lib/macro.py
index b21714e..4a16226 100644
--- a/Allura/allura/lib/macro.py
+++ b/Allura/allura/lib/macro.py
@@ -109,7 +109,8 @@ def neighborhood_blog_posts(max_number=5, sort='timestamp', summary=False):
                 author=post.author().display_name,
                 ago=h.ago(post.timestamp),
                 description=summary and '&nbsp;' or g.markdown.convert(post.text)))
-        for post in posts if security.has_access(post, 'read', project=post.app.project)()
and
+        for post in posts if post.app and
+                             security.has_access(post, 'read', project=post.app.project)()
and
                              security.has_access(post.app.project, 'read', project=post.app.project)())
     return output
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f5a220f8/Allura/allura/model/artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index 3d71aaa..f155bb8 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -186,6 +186,8 @@ class Artifact(MappedClass):
 
     @LazyProperty
     def app(self):
+        if not self.app_config:
+            return None
         if getattr(c, 'app', None) and c.app.config._id == self.app_config._id:
             return c.app
         else:


Mime
View raw message