diff --git a/utils/__init__.py b/utils/__init__.py index a97e9f10f1..d967c1bf72 100644 --- a/utils/__init__.py +++ b/utils/__init__.py @@ -158,10 +158,12 @@ def calculate_repo_last_modify(repo_list): """ for repo in repo_list: - repo.latest_modify = get_commits(repo.id, 0, 1)[0].ctime + cmmts = get_commits(repo.id, 0, 1) + repo.latest_modify = cmmts[0].ctime if cmmts else 0 def check_filename_with_rename(repo_id, parent_dir, filename): - latest_commit = get_commits(repo_id, 0, 1)[0] + cmmts = get_commits(repo_id, 0, 1) + latest_commit = cmmts[0] if cmmts else None if not latest_commit: return '' # TODO: what if parrent_dir does not exist? diff --git a/views/__init__.py b/views/__init__.py index 7a1d3237c9..4c6a4b1209 100644 --- a/views/__init__.py +++ b/views/__init__.py @@ -760,7 +760,8 @@ def myhome(request): r.repo_id = r.id r.repo_name = r.name r.repo_desc = r.desc - last_commit = get_commits(r_id, 0, 1)[0] + cmmts = get_commits(r_id, 0, 1) + last_commit = cmmts[0] if cmmts else None r.last_modified = last_commit.ctime if last_commit else 0 r.share_type = 'group' r.user = get_repo_owner(r_id)