@register.filter
def comment_filter(comment_text):
 filter_func = settings.COMMENT_FILTER
 if (not filter_func):
  def filter_func(s):
   return linebreaksbr(urlize(s, autoescape=True), autoescape=True)
 elif (not callable(filter_func)):
  filter_func = import_dotted_path(filter_func)
 return filter_func(comment_text)

@ register . filter def comment_filter ( comment_text ) : filter_func = settings . COMMENT_FILTER if ( not filter_func ) : def filter_func ( s ) : return linebreaksbr ( urlize ( s , autoescape = True ) , autoescape = True ) elif ( not callable ( filter_func ) ) : filter_func = import_dotted_path ( filter_func ) return filter_func ( comment_text )
passed comment text to be rendered through the function defined by the comment_filter setting .