mirror of
https://github.com/haiwen/seahub.git
synced 2025-04-27 19:05:16 +00:00
Changed rpc name
This commit is contained in:
parent
6c4cf35110
commit
05c8280e40
@ -558,7 +558,7 @@ class RepoFilePathView(ResponseMixin, View):
|
||||
|
||||
file_id = None
|
||||
try:
|
||||
file_id = seafserv_threaded_rpc.get_file_by_path(repo_id,
|
||||
file_id = seafserv_threaded_rpc.get_file_id_by_path(repo_id,
|
||||
path.encode('utf-8'))
|
||||
except SearpcError, e:
|
||||
return api_error(request, '412', "SearpcError:" + e.msg)
|
||||
|
@ -254,7 +254,7 @@ class Repo(APIView):
|
||||
"owner":owner,
|
||||
"name":repo.name,
|
||||
"desc":repo.desc,
|
||||
"mtime":repo.lastest_modify,
|
||||
"mtime":repo.latest_modify,
|
||||
"size":repo.size,
|
||||
"encrypted":repo.encrypted,
|
||||
"root":root_id,
|
||||
@ -459,7 +459,7 @@ class RepoFilepath(APIView):
|
||||
|
||||
file_id = None
|
||||
try:
|
||||
file_id = seafserv_threaded_rpc.get_file_by_path(repo_id,
|
||||
file_id = seafserv_threaded_rpc.get_file_id_by_path(repo_id,
|
||||
path.encode('utf-8'))
|
||||
except SearpcError, e:
|
||||
return api_error(HTTP_520_OPERATION_FAILED,
|
||||
@ -799,7 +799,7 @@ class FileView(APIView):
|
||||
|
||||
file_id = None
|
||||
try:
|
||||
file_id = seafserv_threaded_rpc.get_file_by_path(repo_id,
|
||||
file_id = seafserv_threaded_rpc.get_file_id_by_path(repo_id,
|
||||
path.encode('utf-8'))
|
||||
except SearpcError, e:
|
||||
return api_error(HTTP_520_OPERATION_FAILED,
|
||||
@ -808,6 +808,7 @@ class FileView(APIView):
|
||||
if not file_id:
|
||||
return api_error(status.HTTP_404_NOT_FOUND, "File not found")
|
||||
|
||||
print file_id
|
||||
return get_repo_file(request, repo_id, file_id, file_name, 'download')
|
||||
|
||||
def post(self, request, repo_id, format=None):
|
||||
@ -996,18 +997,12 @@ class DirView(APIView):
|
||||
if resp:
|
||||
return resp
|
||||
|
||||
current_commit = get_commits(repo_id, 0, 1)[0]
|
||||
if not current_commit:
|
||||
return api_error(HTTP_520_OPERATION_FAILED,
|
||||
'Failed to get current commit of repo %s.' % repo_id)
|
||||
|
||||
path = request.GET.get('p', '/')
|
||||
if path[-1] != '/':
|
||||
path = path + '/'
|
||||
|
||||
dir_id = None
|
||||
try:
|
||||
dir_id = seafserv_threaded_rpc.get_dirid_by_path(current_commit.id,
|
||||
dir_id = seafserv_threaded_rpc.get_dir_id_by_path(repo_id,
|
||||
path.encode('utf-8'))
|
||||
except SearpcError, e:
|
||||
return api_error(HTTP_520_OPERATION_FAILED,
|
||||
|
2
utils.py
2
utils.py
@ -543,7 +543,7 @@ def get_starred_files(email, org_id=-1):
|
||||
size = -1;
|
||||
if sfile.path != "/":
|
||||
try:
|
||||
file_id = seafserv_threaded_rpc.get_file_by_path(sfile.repo_id, sfile.path)
|
||||
file_id = seafserv_threaded_rpc.get_file_id_by_path(sfile.repo_id, sfile.path)
|
||||
size = seafserv_threaded_rpc.get_file_size(file_id)
|
||||
except SearpcError:
|
||||
continue
|
||||
|
6
views.py
6
views.py
@ -1197,7 +1197,7 @@ def repo_view_file(request, repo_id):
|
||||
obj_id = request.GET.get('obj_id', '')
|
||||
else:
|
||||
try:
|
||||
obj_id = seafserv_threaded_rpc.get_file_by_path(repo_id, path)
|
||||
obj_id = seafserv_threaded_rpc.get_file_id_by_path(repo_id, path)
|
||||
except:
|
||||
obj_id = None
|
||||
|
||||
@ -1529,7 +1529,7 @@ def repo_file_edit(request, repo_id):
|
||||
head_id = repo.head_cmmt_id
|
||||
|
||||
try:
|
||||
obj_id = seafserv_threaded_rpc.get_file_by_path(repo_id, path)
|
||||
obj_id = seafserv_threaded_rpc.get_file_id_by_path(repo_id, path)
|
||||
except:
|
||||
obj_id = None
|
||||
if not obj_id:
|
||||
@ -2388,7 +2388,7 @@ def view_shared_file(request, token):
|
||||
quote_filename = urllib2.quote(filename.encode('utf-8'))
|
||||
|
||||
try:
|
||||
obj_id = seafserv_threaded_rpc.get_file_by_path(repo_id, path)
|
||||
obj_id = seafserv_threaded_rpc.get_file_id_by_path(repo_id, path)
|
||||
except:
|
||||
obj_id = None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user