def _link_to(text, *args, **kwargs):
 assert (len(args) < 2), 'Too many unnamed arguments'
 def _link_class(kwargs):
  ' creates classes for the link_to calls '
  suppress_active_class = kwargs.pop('suppress_active_class', False)
  if ((not suppress_active_class) and _link_active(kwargs)):
   active = ' active'
  else:
   active = ''
  kwargs.pop('highlight_actions', '')
  return ((kwargs.pop('class_', '') + active) or None)
 def _create_link_text(text, **kwargs):
  ' Update link text to add a icon or span if specified in the\n        kwargs '
  if kwargs.pop('inner_span', None):
   text = ((literal('<span>') + text) + literal('</span>'))
  if icon:
   text = (literal(('<i class="icon-%s"></i> ' % icon)) + text)
  return text
 icon = kwargs.pop('icon', None)
 class_ = _link_class(kwargs)
 return tags.link_to(_create_link_text(text, **kwargs), url_for(*args, **kwargs), class_=class_)

def _link_to ( text , * args , ** kwargs ) : assert ( len ( args ) < 2 ) , 'Too many unnamed arguments' def _link_class ( kwargs ) : suppress_active_class = kwargs . pop ( 'suppress_active_class' , False ) if ( ( not suppress_active_class ) and _link_active ( kwargs ) ) : active = ' active' else : active = '' kwargs . pop ( 'highlight_actions' , '' ) return ( ( kwargs . pop ( 'class_' , '' ) + active ) or None ) def _create_link_text ( text , ** kwargs ) : if kwargs . pop ( 'inner_span' , None ) : text = ( ( literal ( '<span>' ) + text ) + literal ( '</span>' ) ) if icon : text = ( literal ( ( '<i class="icon-%s"></i> ' % icon ) ) + text ) return text icon = kwargs . pop ( 'icon' , None ) class_ = _link_class ( kwargs ) return tags . link_to ( _create_link_text ( text , ** kwargs ) , url_for ( * args , ** kwargs ) , class_ = class_ )
common link making code for several helper functions .