@register.filter
def get_links(value):
 try:
  try:
   from BeautifulSoup import BeautifulSoup
  except ImportError:
   from beautifulsoup import BeautifulSoup
  soup = BeautifulSoup(value)
  return soup.findAll('a')
 except ImportError:
  if settings.DEBUG:
   raise template.TemplateSyntaxError, "Error in 'get_links' filter: BeautifulSoup isn't installed."
 return value

@ register . filter def get_links ( value ) : try : try : from BeautifulSoup import BeautifulSoup except ImportError : from beautifulsoup import BeautifulSoup soup = BeautifulSoup ( value ) return soup . findAll ( 'a' ) except ImportError : if settings . DEBUG : raise template . TemplateSyntaxError , "Error in 'get_links' filter: BeautifulSoup isn't installed." return value
extracts links from a post body and returns a list .