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
The following commit(s) were added to refs/heads/master by this push:
new 7e75c3d97 fix attribute errors in @LazyProperty methods
7e75c3d97 is described below
commit 7e75c3d972706378300023fd5e45218c2ea279a7
Author: Dave Brondsema <[email protected]>
AuthorDate: Tue Sep 10 17:22:26 2024 -0400
fix attribute errors in @LazyProperty methods
---
Allura/allura/model/project.py | 2 ++
Allura/allura/model/repository.py | 13 +++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index 4d673ae2c..d7e65b8c2 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -463,6 +463,8 @@ class Project(SearchIndexable, MappedClass, ActivityNode,
ActivityObject):
@LazyProperty
def icon_timestamp(self):
+ if not self.icon:
+ return None
return timegm(self.icon._id.generation_time.timetuple())
@property
diff --git a/Allura/allura/model/repository.py
b/Allura/allura/model/repository.py
index e51cdcd60..06128afab 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -861,12 +861,12 @@ class MergeRequest(VersionedArtifact, ActivityObject):
@LazyProperty
def downstream_url(self):
with self.push_downstream_context():
- return c.app.url
+ return c.app.url if c.app else None
@LazyProperty
def downstream_repo(self):
with self.push_downstream_context():
- return c.app.repo
+ return c.app.repo if c.app else None
def push_downstream_context(self):
return h.push_context(self.downstream.project_id,
self.downstream.mount_point)
@@ -1610,6 +1610,15 @@ class EmptyBlob(Blob):
def __bool__(self):
return False
+ def content_type(self):
+ return None
+
+ def content_encoding(self):
+ return None
+
+ def has_html_view(self):
+ return False
+
class Symlink(Blob):
# maybe this shouldn't inherit from Blob, but its handy for now and works
well with git (where symlinks are blobs)