@login_required
def component_handler(request, usage_key_string, handler, suffix=''):
 usage_key = UsageKey.from_string(usage_key_string)
 descriptor = modulestore().get_item(usage_key)
 descriptor.xmodule_runtime = StudioEditModuleRuntime(request.user)
 req = django_to_webob_request(request)
 try:
  resp = descriptor.handle(handler, req, suffix)
 except NoSuchHandlerError:
  log.info('XBlock %s attempted to access missing handler %r', descriptor, handler, exc_info=True)
  raise Http404
 modulestore().update_item(descriptor, request.user.id)
 return webob_to_django_response(resp)

@ login_required def component_handler ( request , usage_key_string , handler , suffix = '' ) : usage_key = UsageKey . from_string ( usage_key_string ) descriptor = modulestore ( ) . get_item ( usage_key ) descriptor . xmodule_runtime = StudioEditModuleRuntime ( request . user ) req = django_to_webob_request ( request ) try : resp = descriptor . handle ( handler , req , suffix ) except NoSuchHandlerError : log . info ( 'XBlock %s attempted to access missing handler %r' , descriptor , handler , exc_info = True ) raise Http404 modulestore ( ) . update_item ( descriptor , request . user . id ) return webob_to_django_response ( resp )
dispatch an ajax action to an xblock args: usage_id: the usage-id of the block to dispatch to handler : the handler to execute suffix : the remainder of the url to be passed to the handler returns: :class:django .