Ciaran Farrell avatar Ciaran Farrell committed d59711b

Fix bug caused by failure to see that some users do not have a displayName and some other attributes (e.g. conference rooms)

Comments (0)

Files changed (1)

         #getting responses from GW has been exceeded
         users = resp.freeBusyInfo.user
         for user in users:
+          # remember, conference rooms are users without displayName
+          if hasattr(user,'displayName'):
+            dn = user.displayName
+          else:
+            dn = ''
           u[user.email] = {'email':user.email,'uuid':user.uuid,
-                          'displayName':user.displayName,
+                          'displayName':dn,
                           'blocks':user.blocks}
         if (outstanding == 0) or (datetime.now() >= e):
           self.client.service.closeFreeBusySessionRequest(sessionid)
         return {}
       items = resp.items[0]
       for item in items:
+        print item
+        
         if hasattr(item,'uuid'):
-          email = item.emailList._primary
-          uname = item.emailList._primary.split('@')[0].lower()
-          displayName = item.fullName.displayName
+          if hasattr(item,'emailList'):
+            email = item.emailList._primary
+          elif hasattr(item,'email'):
+            email = item.email
+          else:
+            print "WTF no email!!"
+          uname = email.split('@')[0]
+          if hasattr(item,'fullName'):
+            if hasattr(item,'displayName'):
+              displayName = item.fullName.displayName
+          else:
+            displayName = ''
           uuid = item.uuid
           if u.has_key(uname):
             u[uname]['email'] = email
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.