#NEWLINE# def render( self , name , value , attrs = None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# id_ = attrs [ 'id' ] #NEWLINE# #UNINDENT# except ( KeyError , TypeError ) : #NEWLINE# #INDENT# raise TypeError ( "WidgetWithScript cannot be rendered without an 'id' attribute" ) #NEWLINE# #UNINDENT# widget_html = self . render_html ( name , value , attrs ) #NEWLINE# js = self . render_js_init ( id_ , name , value ) #NEWLINE# out = '{0}<script>{1}</script>' . format ( widget_html , js ) #NEWLINE# return mark_safe ( out )