1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-18 16:36:15 +00:00

Fix code styles

This commit is contained in:
zhengxie
2014-12-24 17:46:24 +08:00
parent ce397dd419
commit d0971e4ae9
2 changed files with 12 additions and 14 deletions

View File

@@ -116,7 +116,7 @@ class Ping(APIView):
"""
Returns a simple `pong` message when client calls `api2/ping/`.
For example:
curl http://127.0.0.1:8000/api2/ping/
curl http://127.0.0.1:8000/api2/ping/
"""
def get(self, request, format=None):
return Response('pong')
@@ -128,7 +128,7 @@ class AuthPing(APIView):
"""
Returns a simple `pong` message when client provided an auth token.
For example:
curl -H "Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b" http://127.0.0.1:8000/api2/auth/ping/
curl -H "Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b" http://127.0.0.1:8000/api2/auth/ping/
"""
authentication_classes = (TokenAuthentication, )
permission_classes = (IsAuthenticated,)
@@ -141,7 +141,7 @@ class ObtainAuthToken(APIView):
"""
Returns auth token if username and password are valid.
For example:
curl -d "username=foo@example.com&password=123456" http://127.0.0.1:8000/api2/auth-token/
curl -d "username=foo@example.com&password=123456" http://127.0.0.1:8000/api2/auth-token/
"""
throttle_classes = (AnonRateThrottle, )
permission_classes = ()
@@ -699,8 +699,8 @@ class Repo(APIView):
username = request.user.username
repo = seafile_api.get_repo(repo_id)
if not repo:
return api_error(status.HTTP_400_BAD_REQUEST, \
'Library does not exist.')
return api_error(status.HTTP_400_BAD_REQUEST,
'Library does not exist.')
# check permission
if is_org_context(request):
@@ -1919,13 +1919,13 @@ class BeShared(APIView):
joined_groups = get_personal_groups_by_user(username)
for grp in joined_groups:
# Get group repos, and for each group repos...
# Get group repos, and for each group repos...
for r_id in get_group_repoids(grp.id):
# No need to list my own repo
if seafile_api.is_repo_owner(username, r_id):
continue
# Convert repo properties due to the different collumns in Repo
# and SharedRepo
# Convert repo properties due to the different collumns in Repo
# and SharedRepo
r = get_repo(r_id)
if not r:
continue
@@ -2055,9 +2055,7 @@ class PrivateSharedFileView(APIView):
return get_repo_file(request, repo_id, file_id, file_name, op)
class SharedFileView(APIView):
# Anyone should be able to access a Shared File assuming they have the token
# authentication_classes = (TokenAuthentication, )
# permission_classes = (IsAuthenticated,)
# Anyone should be able to access a Shared File assuming they have the token
throttle_classes = (UserRateThrottle, )
def get(self, request, token, format=None):

View File

@@ -648,7 +648,7 @@ def copy_move_common(func):
dst_repo_id = request.POST.get('dst_repo')
dst_path = request.POST.get('dst_path')
if not (path and obj_name and dst_repo_id and dst_path):
if not (path and obj_name and dst_repo_id and dst_path):
result['error'] = _('Argument missing')
return HttpResponse(json.dumps(result), status=400,
content_type=content_type)
@@ -1040,7 +1040,7 @@ def get_contacts(request):
from seahub.avatar.templatetags.avatar_tags import avatar
for c in contacts:
try:
user = User.objects.get(email = c.contact_email)
user = User.objects.get(email=c.contact_email)
if user.is_active:
contact_list.append({"email": c.contact_email, "avatar": avatar(c.contact_email, 16)})
except User.DoesNotExist:
@@ -1319,7 +1319,7 @@ def set_notice_seen_by_id(request):
notice_id = request.GET.get('notice_id')
notice = UserNotification.objects.get(id=notice_id)
if notice.seen == False:
if not notice.seen:
notice.seen = True
notice.save()