@pingou looks good. You should perhaps consider doing the format(username=g.fas_user.username) part in the view, wrapped with a try except block in case the configuration doesn't have "{username}" in it. If it excepts, you can fallback to the old way. Once formatted, you can pass it on as a variable to your Jinja2 template.
format(username=g.fas_user.username)
@mprahl unlike %, .format() is much more resilient but I still managed to make it crash:
%
.format()
>>> ' foo {user}'.format(user='bar') ' foo bar' >>> ' foo'.format(user='bar') ' foo' >>> ' foo'.format('bar') ' foo' >>> ' foo {user}'.format('bar') Traceback (most recent call last): File "<input>", line 1, in <module> ' foo {user}'.format('bar') KeyError: 'user' >>> ' foo {}'.format(user='bar') Traceback (most recent call last): File "<input>", line 1, in <module> ' foo {}'.format(user='bar') IndexError: tuple index out of range
So I guess you're right
Adjusted upstream in https://pagure.io/pagure/pull-request/2538
Going to adjust here
Adjusted here as well
rebased
+1
Thanks! :)
Pull-Request has been merged by pingou