[sysadmin-bin] Define user_fullname only when ldapmain is found, additionally make sure correct encodings are passe



commit 099c0f19a85ca06c2de4bb855c71c40e95a90183
Author: Andrea Veri <averi redhat com>
Date:   Fri Nov 17 13:42:23 2017 +0100

    Define user_fullname only when ldapmain is found, additionally make sure correct encodings are passed as 
e-mail headers

 git/gnome-post-receive-email |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/git/gnome-post-receive-email b/git/gnome-post-receive-email
index 227fdda..0b5944f 100755
--- a/git/gnome-post-receive-email
+++ b/git/gnome-post-receive-email
@@ -133,13 +133,14 @@ class RefChange(object):
             if len(user.attributes['identities']) > 0:
                 for index, _ in enumerate(user.attributes['identities']):
                     provider = user.attributes['identities'][index]['provider']
-                    if provider not in ('google_oauth2', 'github', 'gitlab'):
+                    if provider == 'ldapmain':
                         username = 
user.attributes['identities'][index]['extern_uid'].split(',')[0].replace('uid=', '')
 
-                global user_fullname
-                user_fullname = user.attributes['name']
+                        global user_fullname
+                        user_fullname = user.attributes['name']
+                        user_fullname = user_fullname.encode('utf-8')
 
-                user = username
+                        user = username
         else:
             user = os.environ['USER']
 
@@ -147,7 +148,7 @@ class RefChange(object):
             from_address = "%s <%s src gnome org>" % (Header.Header(user_fullname.decode('utf-8')), user)
         else:
             if is_gitlab:
-                from_address = "%s <%s>" % (Header.Header(user.attributes['name'].decode('utf-8')), 
user.attributes['email'])
+                from_address = "%s <%s>" % (Header.Header(user.attributes['name']), user.attributes['email'])
             else:
                 from_address = "%s src gnome org" % (user)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]