I\'m trying to implement a redirecting pattern, similar to what StackOverflow does:
@route(\'///\')
@route(\'//\')
de
I don't understand why you are redirecting. You don't gain anything with the redirect and as you mentioned yourself, you end up just querying the database multiple times. You don't use the given username in any meaningful way, so just ignore it.
@route('///')
@route('//')
def profile(id, username=None):
user = User.query.get_or_404(id)
return render_template('user/profile.html', user=user)
This will satisfy all of your given examples.