mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-10 11:21:29 +00:00
[api] fixed rpc arguments in seahub.api2.views
This commit is contained in:
@@ -55,4 +55,4 @@ if ! [[ -f ${pylintrc} ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pylint --rcfile=${pylintrc} $@
|
||||
pylint --rcfile=${pylintrc} -E $@
|
||||
|
@@ -67,8 +67,8 @@ def calculate_repo_info(repo_list, username):
|
||||
repo.root = commit.root_id
|
||||
repo.size = server_repo_size(repo.id)
|
||||
|
||||
def get_file_size (fid):
|
||||
size = seafile_api.get_file_size(fid)
|
||||
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
|
||||
|
||||
def prepare_starred_files(files):
|
||||
@@ -84,7 +84,7 @@ def prepare_starred_files(files):
|
||||
try:
|
||||
file_id = seafile_api.get_file_id_by_path(f.repo.id, f.path)
|
||||
sfile['oid'] = file_id
|
||||
sfile['size'] = get_file_size(file_id)
|
||||
sfile['size'] = get_file_size(f.repo.store_id, f.repo.version, file_id)
|
||||
except SearpcError, e:
|
||||
pass
|
||||
|
||||
|
@@ -872,7 +872,7 @@ def get_repo_file(request, repo_id, file_id, file_name, op):
|
||||
|
||||
def reloaddir(request, repo, parent_dir):
|
||||
try:
|
||||
dir_id = seafile_api.get_dir_id_by_path(repo_id,
|
||||
dir_id = seafile_api.get_dir_id_by_path(repo.id,
|
||||
parent_dir.encode('utf-8'))
|
||||
except SearpcError, e:
|
||||
logger.error(e)
|
||||
@@ -1451,7 +1451,7 @@ class DirView(APIView):
|
||||
response["oid"] = dir_id
|
||||
return response
|
||||
else:
|
||||
return get_dir_entrys_by_id(request, repo_id, path, dir_id)
|
||||
return get_dir_entrys_by_id(request, repo, path, dir_id)
|
||||
|
||||
def post(self, request, repo_id, format=None):
|
||||
# new dir
|
||||
@@ -1584,7 +1584,7 @@ class DirDownloadView(APIView):
|
||||
return api_error(status.HTTP_404_NOT_FOUND, "Path does not exist")
|
||||
|
||||
try:
|
||||
total_size = seafserv_threaded_rpc.get_dir_size(repo.store_id, reop.version,
|
||||
total_size = seafserv_threaded_rpc.get_dir_size(repo.store_id, repo.version,
|
||||
dir_id)
|
||||
except Exception, e:
|
||||
logger.error(str(e))
|
||||
@@ -2190,6 +2190,7 @@ class UserMsgsView(APIView):
|
||||
UserMessage.objects.update_unread_messages(to_email, username)
|
||||
page = get_page_index(request, 1)
|
||||
|
||||
next_page = -1
|
||||
person_msgs = get_person_msgs(to_email, page, username)
|
||||
if not person_msgs:
|
||||
Response({
|
||||
@@ -2197,7 +2198,6 @@ class UserMsgsView(APIView):
|
||||
'next_page' : next_page,
|
||||
'msgs' : [],})
|
||||
|
||||
next_page = -1
|
||||
if person_msgs.has_next():
|
||||
next_page = person_msgs.next_page_number()
|
||||
|
||||
|
Reference in New Issue
Block a user