def absolute_urls(html):
 from bs4 import BeautifulSoup
 from mezzanine.core.request import current_request
 request = current_request()
 if (request is not None):
  dom = BeautifulSoup(html, u'html.parser')
  for (tag, attr) in ABSOLUTE_URL_TAGS.items():
   for node in dom.findAll(tag):
    url = node.get(attr, u'')
    if url:
     node[attr] = request.build_absolute_uri(url)
  html = str(dom)
 return html

def absolute_urls ( html ) : from bs4 import BeautifulSoup from mezzanine . core . request import current_request request = current_request ( ) if ( request is not None ) : dom = BeautifulSoup ( html , u'html.parser' ) for ( tag , attr ) in ABSOLUTE_URL_TAGS . items ( ) : for node in dom . findAll ( tag ) : url = node . get ( attr , u'' ) if url : node [ attr ] = request . build_absolute_uri ( url ) html = str ( dom ) return html
converts relative urls into absolute urls .