req.py
changeset 3163 edfe43ceaa35
parent 2968 0e3460341023
child 3629 559cad62c786
equal deleted inserted replaced
3090:8184bec7414d 3163:edfe43ceaa35
   232             userinfo['login'] = "cubicweb"
   232             userinfo['login'] = "cubicweb"
   233             userinfo['name'] = "cubicweb"
   233             userinfo['name'] = "cubicweb"
   234             userinfo['email'] = ""
   234             userinfo['email'] = ""
   235             return userinfo
   235             return userinfo
   236         user = self.actual_session().user
   236         user = self.actual_session().user
   237         rql = "Any F,S,A where U eid %(x)s, U firstname F, U surname S, U primary_email E, E address A"
       
   238         try:
       
   239             firstname, lastname, email = self.execute(rql, {'x': user.eid}, 'x')[0]
       
   240             if firstname is None and lastname is None:
       
   241                 userinfo['name'] = ''
       
   242             else:
       
   243                 userinfo['name'] = ("%s %s" % (firstname, lastname))
       
   244             userinfo['email'] = email
       
   245         except IndexError:
       
   246             userinfo['name'] = None
       
   247             userinfo['email'] = None
       
   248         userinfo['login'] = user.login
   237         userinfo['login'] = user.login
       
   238         userinfo['name'] = user.name()
       
   239         userinfo['email'] = user.get_email()
   249         return userinfo
   240         return userinfo
   250 
   241 
   251     def is_internal_session(self):
   242     def is_internal_session(self):
   252         """overrided on the server-side"""
   243         """overrided on the server-side"""
   253         return False
   244         return False