def get_preview_fragment(request, descriptor, context):
 module = _load_preview_module(request, descriptor)
 preview_view = (AUTHOR_VIEW if has_author_view(module) else STUDENT_VIEW)
 try:
  fragment = module.render(preview_view, context)
 except Exception as exc:
  log.warning('Unable to render %s for %r', preview_view, module, exc_info=True)
  fragment = Fragment(render_to_string('html_error.html', {'message': str(exc)}))
 return fragment

def get_preview_fragment ( request , descriptor , context ) : module = _load_preview_module ( request , descriptor ) preview_view = ( AUTHOR_VIEW if has_author_view ( module ) else STUDENT_VIEW ) try : fragment = module . render ( preview_view , context ) except Exception as exc : log . warning ( 'Unable to render %s for %r' , preview_view , module , exc_info = True ) fragment = Fragment ( render_to_string ( 'html_error.html' , { 'message' : str ( exc ) } ) ) return fragment
returns the html returned by the xmodules student_view or author_view .