def checking(*args, **kwargs): api_key = args[0].values.get('api_key', False) if not api_key: return Response(status=401) customer = ApiCustomer.all().filter('api_key =', api_key).get() if not customer or not customer.is_writer: return Response(status=401) return func(*args, **kwargs)
def api_view_key(request, key_key): customer = ApiCustomer.get(key_key) return render_to_response('admin/api/view_key.html', {'customer':customer})
def api_delete_key(request, key_key): customer = ApiCustomer.get(key_key) if customer: customer.delete() return redirect('admin/api/')
def api_index(request): customers = ApiCustomer.all() return render_to_response('admin/api/index.html', {'customers':customers})