def _get_widget_content(content, response_format='html'):
 widget_content = ''
 regexp = '<!-- widget_content -->(?P<widget_content>.*?)<!-- /widget_content -->'
 if (response_format == 'ajax'):
  try:
   ajax_content = json.loads(content)
   widget_content = ajax_content['response']['content']['module_content']
  except:
   blocks = re.finditer(regexp, content, re.DOTALL)
   for block in blocks:
    widget_content = block.group('widget_content').strip()
 else:
  blocks = re.finditer(regexp, content, re.DOTALL)
  for block in blocks:
   widget_content = block.group('widget_content').strip()
 return Markup(widget_content)

def _get_widget_content ( content , response_format = 'html' ) : widget_content = '' regexp = '<!-- widget_content -->(?P<widget_content>.*?)<!-- /widget_content -->' if ( response_format == 'ajax' ) : try : ajax_content = json . loads ( content ) widget_content = ajax_content [ 'response' ] [ 'content' ] [ 'module_content' ] except : blocks = re . finditer ( regexp , content , re . DOTALL ) for block in blocks : widget_content = block . group ( 'widget_content' ) . strip ( ) else : blocks = re . finditer ( regexp , content , re . DOTALL ) for block in blocks : widget_content = block . group ( 'widget_content' ) . strip ( ) return Markup ( widget_content )
extracts widget content from rendred html .