#26 Username in ssh url only when authenicated
Merged by pingou. Opened by pingou.
user_url  into  master

Download 26.patch
no initial comment

@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.

@mprahl unlike %, .format() is much more resilient but I still managed to make it crash:

>>> ' 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

Thanks! :)

Pull-Request has been merged by pingou

Metadata