1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 23:20:51 +00:00

fixed a bug in file contributors

This commit is contained in:
lins05
2012-10-31 15:11:40 +08:00
parent 1fc32d18fd
commit c916aa4266

View File

@@ -377,8 +377,17 @@ def get_file_contributors(repo_id, file_path, file_path_hash, file_id):
contributors = []
last_modified = 0
try:
fc = FileContributors.objects.get(repo_id=repo_id,
file_path_hash=file_path_hash)
# HACK: Fixed the unique key bug in 1.1
# Should be removed in future
fc = FileContributors.objects.filter(repo_id=repo_id,
file_path_hash=file_path_hash)
if not fc:
raise FileContributors.DoesNotExist
else:
if len(fc) > 1:
for e in fc[1:]:
e.delete()
fc = fc[0]
except FileContributors.DoesNotExist:
# has no cache yet
contributors, last_modified = get_file_contributors_from_revisions (repo_id, file_path)