@require_POST
def request_permissions(request):
 uuid = request.POST['uuid']
 resource = get_object_or_404(ResourceBase, uuid=uuid)
 try:
  notification.send([resource.owner], 'request_download_resourcebase', {'from_user': request.user, 'resource': resource})
  return HttpResponse(json.dumps({'success': 'ok'}), status=200, content_type='text/plain')
 except:
  return HttpResponse(json.dumps({'error': 'error delivering notification'}), status=400, content_type='text/plain')

@ require_POST def request_permissions ( request ) : uuid = request . POST [ 'uuid' ] resource = get_object_or_404 ( ResourceBase , uuid = uuid ) try : notification . send ( [ resource . owner ] , 'request_download_resourcebase' , { 'from_user' : request . user , 'resource' : resource } ) return HttpResponse ( json . dumps ( { 'success' : 'ok' } ) , status = 200 , content_type = 'text/plain' ) except : return HttpResponse ( json . dumps ( { 'error' : 'error delivering notification' } ) , status = 400 , content_type = 'text/plain' )
request permission to download a resource .