Skip to content

Commit

Permalink
fix attribute errors in @lazyproperty methods
Browse files Browse the repository at this point in the history
  • Loading branch information
brondsem committed Sep 11, 2024
1 parent a5a3d96 commit 7e75c3d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Allura/allura/model/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,8 @@ def icon_max_size(self):

@LazyProperty
def icon_timestamp(self):
if not self.icon:
return None
return timegm(self.icon._id.generation_time.timetuple())

@property
Expand Down
13 changes: 11 additions & 2 deletions Allura/allura/model/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,12 +861,12 @@ def creator_url(self):
@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)
Expand Down Expand Up @@ -1610,6 +1610,15 @@ def size(self):
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)
Expand Down

0 comments on commit 7e75c3d

Please sign in to comment.