- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
def get_prices(request):
if request.method == 'GET':
if cache.get('price') is None:
if cache.get('price_progress') is None:
tasks.request_async.delay('get_price', 'price', {})
cache.set('price_progress', True, 600)
return HttpResponse(simplejson.dumps({'status':'started'}), mimetype='application/javascript')
else:
return HttpResponse(simplejson.dumps({'status':'processed'}), mimetype='application/javascript')
else:
result = calculate_price(cache.get('price'))
return HttpResponse(simplejson.dumps(result), mimetype='application/javascript')
Stud 17.10.2012 13:36 # −3
roman-kashitsyn 17.10.2012 13:40 # +3
3.14159265 17.10.2012 13:41 # +5