(request)
return d
Mako filter to convert any @id mention to link to user profile
Mako filter to convert any
Mako filter to convert any
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
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