configuration of Physics calc to report progress
Needs rowingdata >= 1.3.2
This commit is contained in:
@@ -367,19 +367,32 @@ def test_job_view2(request,aantal=100):
|
||||
@csrf_exempt
|
||||
def post_progress(request,id=None,value=0):
|
||||
if request.method == 'POST':
|
||||
secret = request.POST['secret']
|
||||
try:
|
||||
secret = request.POST['secret']
|
||||
except KeyError:
|
||||
return HttpResponse('Access Denied',status=401)
|
||||
if secret == settings.PROGRESS_CACHE_SECRET:
|
||||
if id:
|
||||
cache.set(id,value,3600)
|
||||
# test
|
||||
result = cache.get(id)
|
||||
if not id:
|
||||
try:
|
||||
id = request.POST['id']
|
||||
except KeyError:
|
||||
return HttpResponse('Invalid request',400)
|
||||
try:
|
||||
value = request.POST['value']
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
return HttpResponse('progress cached '+str(result),status=200)
|
||||
else:
|
||||
return HttpResponse('access denied',status=400)
|
||||
cache.set(id,value,3600)
|
||||
# test
|
||||
result = cache.get(id)
|
||||
|
||||
else:
|
||||
return HttpResponse('hi',status=200)
|
||||
return HttpResponse('progress cached '+str(result),
|
||||
status=201)
|
||||
else: # secret not given
|
||||
return HttpResponse('access denied',status=401)
|
||||
|
||||
else: # request method is not POST
|
||||
return HttpResponse('GET method not allowed',status=405)
|
||||
|
||||
def get_all_queued_jobs(userid=0):
|
||||
r = StrictRedis()
|
||||
|
||||
Reference in New Issue
Block a user