1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-15 14:49:09 +00:00

[api] Refactor list owned repos, fetch size from repo object, remove root field in response

Conflicts:
	seahub/api2/views.py
This commit is contained in:
zhengxie
2015-03-21 14:49:38 +08:00
committed by Daniel Pan
parent aa5a2dd161
commit 0ff3feaf24
3 changed files with 37 additions and 70 deletions

View File

@@ -61,19 +61,6 @@ def is_repo_accessible(repo_id, username):
else:
return True
def calculate_repo_info(repo_list, username):
"""
Get some info for repo.
"""
for repo in repo_list:
commit = get_commits(repo.id, 0, 1)[0]
if not commit:
continue
repo.latest_modify = commit.ctime
repo.root = commit.root_id
repo.size = server_repo_size(repo.id)
def get_file_size(store_id, repo_version, file_id):
size = seafile_api.get_file_size(store_id, repo_version, file_id)
return size if size else 0