Commit 8347df83 by x

Updated Api for quotas

parent 0066cfc7
...@@ -129,6 +129,14 @@ class StoreApi: ...@@ -129,6 +129,14 @@ class StoreApi:
else: else:
return False return False
@staticmethod @staticmethod
def requestquota(neptun):
url = settings['store_url']+'/'+neptun
r = StoreApi.get_request(url)
if r.status_code == requests.codes.ok:
return json.loads(r.content)
else:
return False
@staticmethod
def userexist(neptun): def userexist(neptun):
url = settings['store_url']+'/'+neptun url = settings['store_url']+'/'+neptun
r = StoreApi.get_request(url) r = StoreApi.get_request(url)
......
...@@ -8,7 +8,11 @@ ...@@ -8,7 +8,11 @@
<input type="hidden" name="auth" value="True"> <input type="hidden" name="auth" value="True">
</form> </form>
</td> </td>
<td></td> <td>
{% for k,v in quota.items %}
{{ k }} : {{ v }}
{% endfor %}
</td>
<td></td> <td></td>
<td> <td>
<form action="/store/" method="POST" <form action="/store/" method="POST"
......
...@@ -79,7 +79,8 @@ def index(request): ...@@ -79,7 +79,8 @@ def index(request):
#Normalize path (Need double dirname /folder/ -> /folder -> / #Normalize path (Need double dirname /folder/ -> /folder -> /
backpath = os.path.normpath(os.path.dirname(os.path.dirname(path))) backpath = os.path.normpath(os.path.dirname(os.path.dirname(path)))
file_list = StoreApi.listfolder(user,path) file_list = StoreApi.listfolder(user,path)
return render_to_response('store/list.html', RequestContext(request, {'file_list': file_list, 'path' : path, 'backpath' : backpath, 'username' : user})) quota = StoreApi.requestquota(user)
return render_to_response('store/list.html', RequestContext(request, {'file_list': file_list, 'path' : path, 'backpath' : backpath, 'username' : user, 'quota' : quota}))
@login_required @login_required
def ajax_listfolder(request): def ajax_listfolder(request):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment