@login_required
@ensure_csrf_cookie
def assets_handler(request, course_key_string=None, asset_key_string=None):
 course_key = CourseKey.from_string(course_key_string)
 if (not has_course_author_access(request.user, course_key)):
  raise PermissionDenied()
 response_format = (request.GET.get('format') or request.POST.get('format') or 'html')
 if ((response_format == 'json') or ('application/json' in request.META.get('HTTP_ACCEPT', 'application/json'))):
  if (request.method == 'GET'):
   return _assets_json(request, course_key)
  else:
   asset_key = (AssetKey.from_string(asset_key_string) if asset_key_string else None)
   return _update_asset(request, course_key, asset_key)
 elif (request.method == 'GET'):
  return _asset_index(request, course_key)
 else:
  return HttpResponseNotFound()

@ login_required @ ensure_csrf_cookie def assets_handler ( request , course_key_string = None , asset_key_string = None ) : course_key = CourseKey . from_string ( course_key_string ) if ( not has_course_author_access ( request . user , course_key ) ) : raise PermissionDenied ( ) response_format = ( request . GET . get ( 'format' ) or request . POST . get ( 'format' ) or 'html' ) if ( ( response_format == 'json' ) or ( 'application/json' in request . META . get ( 'HTTP_ACCEPT' , 'application/json' ) ) ) : if ( request . method == 'GET' ) : return _assets_json ( request , course_key ) else : asset_key = ( AssetKey . from_string ( asset_key_string ) if asset_key_string else None ) return _update_asset ( request , course_key , asset_key ) elif ( request . method == 'GET' ) : return _asset_index ( request , course_key ) else : return HttpResponseNotFound ( )
the restful handler for assets .