1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 23:48:47 +00:00

Add org account feature

This commit is contained in:
xiez
2012-06-20 19:39:21 +08:00
parent 5b96dc2ab2
commit 9c4a54931f
36 changed files with 1039 additions and 85 deletions

View File

@@ -9,7 +9,7 @@ from django.utils.hashcompat import sha_constructor
def go_permission_error(request, msg=None):
"""
return permisson error page
Return permisson error page.
"""
return render_to_response('permission_error.html', {
@@ -18,7 +18,7 @@ def go_permission_error(request, msg=None):
def go_error(request, msg=None):
"""
return normal error page
Return normal error page.
"""
return render_to_response('error.html', {
@@ -27,20 +27,15 @@ def go_error(request, msg=None):
def list_to_string(l):
"""
return string of a list
Return string of a list.
"""
tmp_str = ''
for e in l[:-1]:
tmp_str = tmp_str + e + ', '
tmp_str = tmp_str + l[-1]
return tmp_str
return ','.join(l)
def get_httpserver_root():
"""
Get seafile http server address and port from settings.py,
and cut out last '/'
and cut out last '/'.
"""
if settings.HTTP_SERVER_ROOT[-1] == '/':
@@ -52,7 +47,7 @@ def get_httpserver_root():
def get_ccnetapplet_root():
"""
Get ccnet applet address and port from settings.py,
and cut out last '/'
and cut out last '/'.
"""
if settings.CCNET_APPLET_ROOT[-1] == '/':
@@ -63,17 +58,17 @@ def get_ccnetapplet_root():
def gen_token():
"""
Generate short token used for owner to access repo file
Generate short token used for owner to access repo file.
"""
token = sha_constructor(settings.SECRET_KEY + unicode(time.time())).hexdigest()[::8]
token = sha_constructor(settings.SECRET_KEY + unicode(time.time())).hexdigest()[:5]
return token
def validate_group_name(group_name):
"""
Check whether group name is valid.
A valid group name only contains alphanumeric character
A valid group name only contains alphanumeric character.
"""
return re.match('^\w+$', group_name, re.U)