parameters: (request)
return_statement: return d
docstring: Mako filter to convert any @id mention to link to user profile
docstring_summary: Mako filter to convert any
docstring_tokens: Mako filter to convert any
function: def convert_mentions(request):
      ''' Mako filter to convert any @id mention to link to user profile
      '''
      def d(text):
          def repl(val):
              user_id = val.group()[1:]
              user = DBSession.query(User).get(user_id)
              link = request.route_path('user', username=user.username)
              return '[@%s](%s)' % (user.username, link)
  
          return re.sub(p, repl, text)
  
      return d
function_tokens: def convert_mentions ( request ) : def d ( text ) : def repl ( val ) : user_id = val . group ( ) [ 1 : ] user = DBSession . query ( User ) . get ( user_id ) link = request . route_path ( 'user' , username = user . username ) return '[@%s](%s)' % ( user . username , link ) return re . sub ( p , repl , text ) return d