diff --git a/seahub/constants.py b/seahub/constants.py
index 5cf5b78baa..9510d1226b 100644
--- a/seahub/constants.py
+++ b/seahub/constants.py
@@ -19,11 +19,7 @@ DAILY_ADMIN = 'daily_admin'
AUDIT_ADMIN = 'audit_admin'
HASH_URLS = {
- 'VIEW_COMMON_LIB_DIR': settings.SITE_ROOT + '#common/lib/%(repo_id)s/%(path)s',
- 'GROUP_INFO': settings.SITE_ROOT + '#group/%(group_id)s/',
'GROUP_MEMBERS': settings.SITE_ROOT + '#group/%(group_id)s/members/',
'GROUP_DISCUSS': settings.SITE_ROOT + '#group/%(group_id)s/discussions/',
- 'GROUP_LIST': settings.SITE_ROOT + '#groups/',
'SYS_REPO_ADMIN': settings.SITE_ROOT + 'sysadmin/#all-libs/',
-
}
diff --git a/seahub/group/views.py b/seahub/group/views.py
index 5ac325ec91..7d50214095 100644
--- a/seahub/group/views.py
+++ b/seahub/group/views.py
@@ -40,7 +40,6 @@ from seahub.views import is_registered_user, check_folder_permission
from seahub.views.modules import get_enabled_mods_by_group, \
get_available_mods_by_group
from seahub.share.models import ExtraGroupsSharePermission
-from seahub.constants import HASH_URLS
from seahub.forms import SharedRepoCreateForm
@@ -96,7 +95,8 @@ def group_check(func):
group_id_int = int(group_id) # Checked by URL Conf
group = get_group(group_id_int)
if not group:
- return HttpResponseRedirect(HASH_URLS['GROUP_LIST'])
+ group_list_url = reverse('groups')
+ return HttpResponseRedirect(group_list_url)
group.is_staff = False
if PublicGroup.objects.filter(group_id=group.id):
group.is_pub = True
diff --git a/seahub/notifications/management/commands/send_file_updates.py b/seahub/notifications/management/commands/send_file_updates.py
index a35a0cd34a..4bec516eac 100644
--- a/seahub/notifications/management/commands/send_file_updates.py
+++ b/seahub/notifications/management/commands/send_file_updates.py
@@ -35,18 +35,18 @@ def td(con):
def a_tag(con, href='#', style=''):
return '%s' % (href, style, e(con))
-def repo_url(repo_id):
- p = HASH_URLS["VIEW_COMMON_LIB_DIR"] % {'repo_id': repo_id, 'path': ''}
+def repo_url(repo_id, repo_name):
+ p = reverse('lib_view', args=[repo_id, repo_name, ''])
+
return get_site_scheme_and_netloc() + p
def file_url(repo_id, file_path):
p = reverse('view_lib_file', args=[repo_id, file_path])
return get_site_scheme_and_netloc() + p
-def dir_url(repo_id, dir_path):
- p = HASH_URLS["VIEW_COMMON_LIB_DIR"] % {
- 'repo_id': repo_id, 'path': dir_path.strip('/')
- }
+def dir_url(repo_id, repo_name, dir_path):
+ p = reverse('lib_view', args=[repo_id, repo_name, dir_path.strip('/')])
+
return get_site_scheme_and_netloc() + p
def user_info_url(username):
@@ -100,8 +100,8 @@ class Command(BaseCommand):
return Profile.objects.get_user_language(username)
def format_file_operation(self, ev):
- lib_link = a_tag(ev.repo_name, repo_url(ev.repo_id))
- small_lib_link = a_tag(ev.repo_name, repo_url(ev.repo_id), 'color:#868e96;font-size:87.5%;')
+ lib_link = a_tag(ev.repo_name, repo_url(ev.repo_id, ev.repo_name))
+ small_lib_link = a_tag(ev.repo_name, repo_url(ev.repo_id, ev.repo_name), 'color:#868e96;font-size:87.5%;')
if ev.obj_type == 'repo':
if ev.op_type == 'create':
op = _('Created library')
@@ -153,7 +153,7 @@ class Command(BaseCommand):
else: # dir
dir_name = os.path.basename(ev.path)
- dir_link = a_tag(dir_name, dir_url(ev.repo_id, ev.path))
+ dir_link = a_tag(dir_name, dir_url(ev.repo_id, ev.repo_name, ev.path))
if ev.op_type == 'create':
op = _('Created folder')
details = td('%s
%s' % (dir_link, small_lib_link))
diff --git a/seahub/notifications/management/commands/send_notices.py b/seahub/notifications/management/commands/send_notices.py
index 1ec802214b..9761a262fc 100644
--- a/seahub/notifications/management/commands/send_notices.py
+++ b/seahub/notifications/management/commands/send_notices.py
@@ -98,7 +98,8 @@ class Command(BaseCommand):
owner = seafile_api.get_repo_owner(repo_id)
repo = seafile_api.get_virtual_repo(repo_id, path, owner)
- notice.repo_url = HASH_URLS["VIEW_COMMON_LIB_DIR"] % {'repo_id': repo_id, 'path': ''}
+ repo_url = reverse('lib_view', args=[repo_id, repo.name, ''])
+ notice.repo_url = repo_url
notice.notice_from = escape(email2nickname(d['share_from']))
notice.repo_name = repo.name
notice.avatar_src = self.get_avatar_src(d['share_from'])
@@ -128,11 +129,12 @@ class Command(BaseCommand):
owner = seafile_api.get_repo_owner(repo_id)
repo = seafile_api.get_virtual_repo(repo_id, path, owner)
- notice.repo_url = HASH_URLS["VIEW_COMMON_LIB_DIR"] % {'repo_id': repo_id, 'path': ''}
+ repo_url = reverse('lib_view', args=[repo_id, repo.name, ''])
+ notice.repo_url = repo_url
notice.notice_from = escape(email2nickname(d['share_from']))
notice.repo_name = repo.name
notice.avatar_src = self.get_avatar_src(d['share_from'])
- notice.group_url = HASH_URLS['GROUP_INFO'] % {'group_id': group.id}
+ notice.group_url = reverse('group', args=[group.id])
notice.group_name = group.group_name
notice.shared_type = shared_type
@@ -143,10 +145,12 @@ class Command(BaseCommand):
file_name = d['file_name']
repo_id = d['repo_id']
+ repo = seafile_api.get_repo(repo_id)
uploaded_to = d['uploaded_to'].rstrip('/')
file_path = uploaded_to + '/' + file_name
file_link = reverse('view_lib_file', args=[repo_id, file_path])
- folder_link = HASH_URLS["VIEW_COMMON_LIB_DIR"] % {'repo_id': repo_id, 'path': uploaded_to.strip('/')}
+
+ folder_link = reverse('lib_view', args=[repo_id, repo.name, uploaded_to.strip('/')])
folder_name = os.path.basename(uploaded_to)
notice.file_link = file_link
@@ -184,7 +188,7 @@ class Command(BaseCommand):
notice.avatar_src = self.get_avatar_src(group_staff)
notice.group_staff_profile_url = reverse('user_profile',
args=[group_staff])
- notice.group_url = HASH_URLS['GROUP_INFO'] % {'group_id': group_id}
+ notice.group_url = reverse('group', args=[group.id])
notice.group_name = group.group_name
return notice
diff --git a/seahub/notifications/models.py b/seahub/notifications/models.py
index aa7729bd51..c6497c1958 100644
--- a/seahub/notifications/models.py
+++ b/seahub/notifications/models.py
@@ -5,6 +5,7 @@ import os
import json
import logging
+from django.core.urlresolvers import reverse
from django.db import models
from django.conf import settings
from django.forms import ModelForm, Textarea
@@ -505,15 +506,13 @@ class UserNotification(models.Model):
if d['uploaded_to'] == '/':
# current upload path is '/'
file_path = '/' + filename
- link = HASH_URLS["VIEW_COMMON_LIB_DIR"] % {'repo_id': repo_id, 'path': ''}
+ link = reverse('lib_view', args=[repo_id, repo.name, ''])
name = repo.name
else:
uploaded_to = d['uploaded_to'].rstrip('/')
file_path = uploaded_to + '/' + filename
- link = HASH_URLS["VIEW_COMMON_LIB_DIR"] % {'repo_id': repo_id,
- 'path': uploaded_to.lstrip('/')}
+ link = reverse('lib_view', args=[repo_id, repo.name, uploaded_to.lstrip('/')])
name = os.path.basename(uploaded_to)
-
file_link = reverse('view_lib_file', args=[repo_id, file_path])
msg = _(u"A file named %(file_name)s is uploaded to %(name)s") % {
@@ -571,12 +570,10 @@ class UserNotification(models.Model):
else:
tmpl = 'notifications/notice_msg/folder_share_msg.html'
+ lib_url = reverse('lib_view', args=[repo.id, repo.name, ''])
msg = render_to_string(tmpl, {
'user': share_from,
- 'lib_url': HASH_URLS["VIEW_COMMON_LIB_DIR"] % {
- 'repo_id': repo.id,
- 'path': ''
- },
+ 'lib_url': lib_url,
'lib_name': repo.name,
})
@@ -626,14 +623,13 @@ class UserNotification(models.Model):
else:
tmpl = 'notifications/notice_msg/folder_share_to_group_msg.html'
+ lib_url = reverse('lib_view', args=[repo.id, repo.name, ''])
+ group_url = reverse('group', args=[group.id])
msg = render_to_string(tmpl, {
'user': share_from,
- 'lib_url': HASH_URLS["VIEW_COMMON_LIB_DIR"] % {
- 'repo_id': repo.id,
- 'path': ''
- },
+ 'lib_url': lib_url,
'lib_name': repo.name,
- 'group_url': HASH_URLS['GROUP_INFO'] % {'group_id': group.id},
+ 'group_url': group_url,
'group_name': group.group_name,
})
@@ -742,7 +738,7 @@ class UserNotification(models.Model):
msg = _(u"User %(group_staff)s has added you to group %(group_name)s") % {
'user_profile': reverse('user_profile', args=[group_staff]),
'group_staff': escape(email2nickname(group_staff)),
- 'href': HASH_URLS['GROUP_INFO'] % {'group_id': group_id},
+ 'href': reverse('group', args=[group_id]),
'group_name': escape(group.group_name)}
return msg
@@ -858,7 +854,6 @@ class UserNotification(models.Model):
########## handle signals
-from django.core.urlresolvers import reverse
from django.dispatch import receiver
from seahub.signals import upload_file_successful, comment_file_successful
diff --git a/seahub/urls.py b/seahub/urls.py
index 44277b98f5..98aeb000e9 100644
--- a/seahub/urls.py
+++ b/seahub/urls.py
@@ -204,8 +204,8 @@ urlpatterns = [
url(r'^shared-libs/$', react_fake_view, name="shared_libs"),
url(r'^my-libs/$', react_fake_view, name="my_libs"),
url(r'^groups/$', react_fake_view, name="groups"),
- url(r'^group/.*$', react_fake_view, name="group"),
- url(r'^library/.*$', react_fake_view, name="lib_view"),
+ url(r'^group/(?P\d+)/$', react_fake_view, name="group"),
+ url(r'^library/(?P[-0-9a-f]{36})/(?P[^/]+)/(?P.*)$', react_fake_view, name="lib_view"),
url(r'^my-libs/deleted/$', react_fake_view, name="my_libs_deleted"),
url(r'^org/$', react_fake_view, name="org"),
diff --git a/seahub/views/__init__.py b/seahub/views/__init__.py
index 408b53f6f6..ce6fc8e5bd 100644
--- a/seahub/views/__init__.py
+++ b/seahub/views/__init__.py
@@ -180,8 +180,7 @@ def get_repo_dirents(request, repo, commit, path, offset=-1, limit=-1):
fileshares = FileShare.objects.filter(repo_id=repo.id).filter(username=username)
uploadlinks = UploadLinkShare.objects.filter(repo_id=repo.id).filter(username=username)
-
- view_dir_base = HASH_URLS["VIEW_COMMON_LIB_DIR"] % {'repo_id': repo.id, 'path': ''}
+ view_dir_base = reverse('lib_view', args=[repo.id, repo.name, ''])
dl_dir_base = reverse('repo_download_dir', args=[repo.id])
file_history_base = reverse('file_revisions', args=[repo.id])
for dirent in dirs:
@@ -466,7 +465,7 @@ def repo_history(request, repo_id):
return render_error(request, e.msg)
if not password_set:
- reverse_url = HASH_URLS["VIEW_COMMON_LIB_DIR"] % {'repo_id': repo_id, 'path': ''}
+ reverse_url = reverse('lib_view', args=[repo_id, repo.name, ''])
return HttpResponseRedirect(reverse_url)
try:
@@ -551,7 +550,7 @@ def repo_revert_history(request, repo_id):
return render_error(request, e.msg)
if not password_set:
- reverse_url = HASH_URLS["VIEW_COMMON_LIB_DIR"] % {'repo_id': repo_id, 'path': ''}
+ reverse_url = reverse('lib_view', args=[repo_id, repo.name, ''])
return HttpResponseRedirect(reverse_url)
commit_id = request.GET.get('commit_id', '')
@@ -576,8 +575,8 @@ def repo_revert_history(request, repo_id):
def fpath_to_link(repo_id, path, is_dir=False):
"""Translate file path of a repo to its view link"""
if is_dir:
- href = HASH_URLS["VIEW_COMMON_LIB_DIR"] % {'repo_id': repo_id, 'path': path.strip('/')}
- href = urlquote(href, safe='/#')
+ repo = seafile_api.get_repo(repo_id)
+ href = reverse('lib_view', args=[repo_id, repo.name, path.strip('/')])
else:
if not path.startswith('/'):
p = '/' + path
@@ -754,7 +753,8 @@ def libraries(request):
def repo_set_access_property(request, repo_id):
ap = request.GET.get('ap', '')
seafserv_threaded_rpc.repo_set_access_property(repo_id, ap)
- reverse_url = HASH_URLS["VIEW_COMMON_LIB_DIR"] % {'repo_id': repo_id, 'path': ''}
+ repo = seafile_api.get_repo(repo_id)
+ reverse_url = reverse('lib_view', args=[repo_id, repo.name, ''])
return HttpResponseRedirect(reverse_url)
@@ -1051,13 +1051,13 @@ def convert_cmmt_desc_link(request):
elif d.status == 'mov': # Move or Rename non-empty file/folder
if '/' in d.new_name:
new_dir_name = d.new_name.split('/')[0]
- reverse_url = HASH_URLS["VIEW_COMMON_LIB_DIR"] % {'repo_id': repo_id, 'path': new_dir_name}
+ reverse_url = reverse('lib_view', args=[repo_id, repo.name, new_dir_name])
return HttpResponseRedirect(reverse_url)
else:
return HttpResponseRedirect(
reverse('view_lib_file', args=[repo_id, '/' + d.new_name]))
elif d.status == 'newdir':
- reverse_url = HASH_URLS["VIEW_COMMON_LIB_DIR"] % {'repo_id': repo_id, 'path': d.name.strip('/')},
+ reverse_url = reverse('lib_view', args=[repo_id, repo.name, d.name.strip('/')])
return HttpResponseRedirect(reverse_url)
else:
continue
@@ -1214,7 +1214,7 @@ def choose_register(request):
})
@login_required
-def react_fake_view(request):
+def react_fake_view(request, **kwargs):
return render(request, "react_app.html", {
'seafile_collab_server': SEAFILE_COLLAB_SERVER,
diff --git a/seahub/views/ajax.py b/seahub/views/ajax.py
index 561c2f20a2..8528baadd5 100644
--- a/seahub/views/ajax.py
+++ b/seahub/views/ajax.py
@@ -817,8 +817,8 @@ def mv_dirents(request, src_repo_id, src_path, dst_repo_id, dst_path,
success.append(obj_name)
if len(success) > 0:
- url = HASH_URLS["VIEW_COMMON_LIB_DIR"] % {'repo_id': dst_repo_id, 'path': dst_path.strip('/')},
-
+ dst_repo = seafile_api.get_repo(dst_repo_id)
+ url = reverse('lib_view', args=[dst_repo_id, dst_repo.name, dst_path.strip('/')])
result = {'success': success, 'failed': failed, 'url': url}
return HttpResponse(json.dumps(result), content_type=content_type)
@@ -890,8 +890,8 @@ def cp_dirents(request, src_repo_id, src_path, dst_repo_id, dst_path, obj_file_n
success.append(obj_name)
if len(success) > 0:
- url = HASH_URLS["VIEW_COMMON_LIB_DIR"] % {'repo_id': dst_repo_id, 'path': dst_path.strip('/')},
-
+ dst_repo = seafile_api.get_repo(dst_repo_id)
+ url = reverse('lib_view', args=[dst_repo_id, dst_repo.name, dst_path.strip('/')])
result = {'success': success, 'failed': failed, 'url': url}
return HttpResponse(json.dumps(result), content_type=content_type)
diff --git a/seahub/views/file.py b/seahub/views/file.py
index e74fc8a06e..eed4b88e7b 100644
--- a/seahub/views/file.py
+++ b/seahub/views/file.py
@@ -1676,7 +1676,7 @@ def download_file(request, repo_id, obj_id):
raise Http404
if repo.encrypted and not seafile_api.is_password_set(repo_id, username):
- reverse_url = HASH_URLS["VIEW_COMMON_LIB_DIR"] % {'repo_id': repo_id, 'path': ''}
+ reverse_url = reverse('lib_view', args=[repo_id, repo.name, ''])
return HttpResponseRedirect(reverse_url)
# only check the permissions at the repo level
diff --git a/seahub/views/repo.py b/seahub/views/repo.py
index 6fc08c594b..e1dfa5af8a 100644
--- a/seahub/views/repo.py
+++ b/seahub/views/repo.py
@@ -4,6 +4,7 @@ import os
import posixpath
import logging
+from django.core.urlresolvers import reverse
from django.db.models import F
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import render
@@ -115,7 +116,7 @@ def repo_history_view(request, repo_id):
# Assume server_crypto is ``False`` if this option is not set.
server_crypto = False
- reverse_url = HASH_URLS["VIEW_COMMON_LIB_DIR"] % {'repo_id': repo_id, 'path': ''}
+ reverse_url = reverse('lib_view', args=[repo_id, repo.name, ''])
if repo.encrypted and \
(repo.enc_version == 1 or (repo.enc_version == 2 and server_crypto)) \
and not is_password_set(repo.id, username):
diff --git a/tests/seahub/notifications/management/commands/test_send_notices.py b/tests/seahub/notifications/management/commands/test_send_notices.py
index 386171b0af..5ce34d933a 100644
--- a/tests/seahub/notifications/management/commands/test_send_notices.py
+++ b/tests/seahub/notifications/management/commands/test_send_notices.py
@@ -127,8 +127,8 @@ class CommandTest(BaseTestCase):
notice = UserNotification.objects.add_repo_share_msg('to@to.com', detail)
resp = Command().format_repo_share_msg(notice)
- assert resp.repo_url == '/#common/lib/%(repo_id)s/%(path)s' % {'repo_id': self.repo.id,
- 'path': ''}
+ assert resp.repo_url == '/library/%(repo_id)s/%(repo_name)s/%(path)s' % {
+ 'repo_id': self.repo.id, 'repo_name': self.repo.name, 'path': ''}
def test_format_group_message(self):
detail = group_msg_to_json(self.group.id, 'from@email.com', 'message')
@@ -144,9 +144,9 @@ class CommandTest(BaseTestCase):
notice = UserNotification.objects.add_repo_share_to_group_msg('group@share.com', detail)
resp = Command().format_repo_share_to_group_msg(notice)
- assert resp.repo_url == '/#common/lib/%(repo_id)s/%(path)s' % {'repo_id': self.repo.id,
- 'path': ''}
- assert resp.group_url == '/#group/%(group_id)s/' % {'group_id': self.group.id}
+ assert resp.repo_url == '/library/%(repo_id)s/%(repo_name)s/%(path)s' % {
+ 'repo_id': self.repo.id, 'repo_name': self.repo.name, 'path': ''}
+ assert resp.group_url == '/group/%(group_id)s/' % {'group_id': self.group.id}
def test_format_file_uploaded_msg(self):
upload_to = '/'
@@ -154,8 +154,8 @@ class CommandTest(BaseTestCase):
notice = UserNotification.objects.add_file_uploaded_msg('file@upload.com', detail)
resp = Command().format_file_uploaded_msg(notice)
- assert resp.folder_link == '/#common/lib/%(repo_id)s/%(path)s' % {'repo_id': self.repo.id,
- 'path': upload_to.strip('/')}
+ assert resp.folder_link == '/library/%(repo_id)s/%(repo_name)s/%(path)s' % {
+ 'repo_id': self.repo.id, 'repo_name': self.repo.name, 'path': upload_to.strip('/')}
def test_format_group_join_request(self):
detail = group_join_request_to_json('group_join', self.group.id, 'join_request_msg')
@@ -171,4 +171,4 @@ class CommandTest(BaseTestCase):
detail=detail)
resp = Command().format_add_user_to_group(notice)
- assert resp.group_url == '/#group/%(group_id)s/' % {'group_id': self.group.id}
+ assert resp.group_url == '/group/%(group_id)s/' % {'group_id': self.group.id}
diff --git a/tests/seahub/notifications/test_models.py b/tests/seahub/notifications/test_models.py
index 9bb8a4ba69..f0a3c2b34b 100644
--- a/tests/seahub/notifications/test_models.py
+++ b/tests/seahub/notifications/test_models.py
@@ -25,7 +25,8 @@ class UserNotificationTest(BaseTestCase):
notice = UserNotification.objects.add_file_uploaded_msg('file@upload.com', detail)
msg = notice.format_file_uploaded_msg()
- assert '/#common/lib/%(repo_id)s/%(path)s' % {'repo_id': self.repo.id,
+ assert '/library/%(repo_id)s/%(repo_name)s/%(path)s' % {'repo_id': self.repo.id,
+ 'repo_name': self.repo.name,
'path': upload_to.strip('/')} in msg
def test_format_group_message_title(self):
@@ -46,7 +47,7 @@ class UserNotificationTest(BaseTestCase):
notice = UserNotification.objects.set_add_user_to_group_notice(self.user.username,
detail=detail)
msg = notice.format_add_user_to_group()
- assert '/#group/%(group_id)s/' % {'group_id': self.group.id} in msg
+ assert '/group/%(group_id)s/' % {'group_id': self.group.id} in msg
def test_format_repo_share_msg(self):
notice = UserNotification.objects.add_repo_share_msg(
@@ -56,8 +57,10 @@ class UserNotificationTest(BaseTestCase):
msg = notice.format_repo_share_msg()
assert msg is not None
assert 'bar has shared a library named' in msg
- assert '/#common/lib/%(repo_id)s/%(path)s' % {'repo_id': self.repo.id,
- 'path': ''} in msg
+ assert '/library/%(repo_id)s/%(repo_name)s/%(path)s' % {
+ 'repo_id': self.repo.id,
+ 'repo_name': self.repo.name,
+ 'path': ''} in msg
def test_format_repo_share_msg_with_folder(self):
folder_path = self.folder
@@ -79,7 +82,7 @@ class UserNotificationTest(BaseTestCase):
msg = notice.format_repo_share_to_group_msg()
assert msg is not None
assert 'bar has shared a library named' in msg
- assert '/#group/%(group_id)s/' % {'group_id': self.group.id} in msg
+ assert '/group/%(group_id)s/' % {'group_id': self.group.id} in msg
def test_format_repo_share_to_group_msg_with_folder(self):
folder_path = self.folder
diff --git a/tests/seahub/views/init/test_fpath_to_link.py b/tests/seahub/views/init/test_fpath_to_link.py
index a13d369f6b..d0a3a5664c 100644
--- a/tests/seahub/views/init/test_fpath_to_link.py
+++ b/tests/seahub/views/init/test_fpath_to_link.py
@@ -8,7 +8,8 @@ class FpathToLinkTest(BaseTestCase):
def test_fpath_to_link(self):
path = '/海文/'.decode('utf-8')
resp = fpath_to_link(self.repo.id, path, is_dir=True)
- url = '/#common/lib/%(repo_id)s/%(path)s' % {'repo_id': self.repo.id,
+ url = '/library/%(repo_id)s/%(repo_name)s/%(path)s' % {'repo_id': self.repo.id,
+ 'repo_name': self.repo.name,
'path': path.strip('/')}
- assert urlquote(url, safe='/#') in resp
+ assert urlquote(url) in resp
diff --git a/tests/seahub/views/init/test_repo_history.py b/tests/seahub/views/init/test_repo_history.py
index c901298605..456457b677 100644
--- a/tests/seahub/views/init/test_repo_history.py
+++ b/tests/seahub/views/init/test_repo_history.py
@@ -17,5 +17,5 @@ class RepoHistoryTest(BaseTestCase):
resp = self.client.get(reverse('repo_history', args=[self.enc_repo.id]))
self.assertEqual(302, resp.status_code)
- assert '/#common/lib/%(repo_id)s/%(path)s' % {
- 'repo_id': self.enc_repo.id, 'path': ''} in resp.url
+ assert '/library/%(repo_id)s/%(repo_name)s/%(path)s' % {
+ 'repo_id': self.enc_repo.id, 'repo_name': self.enc_repo.name, 'path': ''} in resp.url
diff --git a/tests/seahub/views/init/test_repo_revert_history.py b/tests/seahub/views/init/test_repo_revert_history.py
index ec762f70bc..c2a2a24071 100644
--- a/tests/seahub/views/init/test_repo_revert_history.py
+++ b/tests/seahub/views/init/test_repo_revert_history.py
@@ -17,5 +17,5 @@ class RepoRevertHistoryTest(BaseTestCase):
resp = self.client.post(reverse('repo_revert_history', args=[self.enc_repo.id]) + '?commit_id=xxx', {})
self.assertEqual(302, resp.status_code)
- assert '/#common/lib/%(repo_id)s/%(path)s' % {
- 'repo_id': self.enc_repo.id, 'path': ''} in resp.url
+ assert '/library/%(repo_id)s/%(repo_name)s/%(path)s' % {
+ 'repo_id': self.enc_repo.id, 'repo_name': self.enc_repo.name, 'path': ''} in resp.url