Ciaran Farrell avatar Ciaran Farrell committed 3afd7fb

Fix more bugs with missing item attributes and upper vs lower case in dict keys

Comments (0)

Files changed (2)

                 f = "%Y-%m-%d %H:%M"
                 print "The following time slots are available:"
                 for x in bt:
-                  print "%s until %s"%x
-                  #view = GWSimpleBusyView(bt)
-                  #view.render()
+                  print "%s until %s"%(x[0].strftime(f),x[1].strftime(f))
     ok = True
     for x in l:
       f = "%Y-%m-%d %H:%M"
+      i,j = x,r[l.index(x)]
       s,e = x.strftime(f),r[l.index(x)].strftime(f)
       if s == e:
         logger.debug('Ignoring tuple (%s %s) as the times are identical'%(s,e))
-        t.append((s,e))
+        t.append((i,j))
     return t
   def getBusyTimes(self,sessionid,st=datetime.utcnow(),et=None):
     FilterGroup.op = 'or'
     u = {}
     for user in users:
-      user1 = user.split('@')[0]
+      user1 = user.split('@')[0].lower()
       u[user1] = {'uuid':None}
       FilterEntry = self.client.factory.create('ns2:FilterEntry')
       FilterEntry.field = 'username'
     Filter.element = FilterGroup
     resp = self.client.service.getItemsRequest(self.addressbookid,
+    displayName = ''
     if int(resp.status.code)==0:
       if len(resp.items)==0:
         return {}
       items = resp.items[0]
-      for item in items:
-        print item
+      for item in items:  
         if hasattr(item,'uuid'):
           if hasattr(item,'emailList'):
             email = item.emailList._primary
           elif hasattr(item,'email'):
             email =
-            print "WTF no email!!"
+            logger.error('cannot determine email for %s'%item)
           uname = email.split('@')[0]
           if hasattr(item,'fullName'):
             if hasattr(item,'displayName'):
             displayName = ''
           uuid = item.uuid
-          if u.has_key(uname):
-            u[uname]['email'] = email
-            u[uname]['uuid'] = uuid
-            u[uname]['displayName'] = displayName
+          if u.has_key(uname.lower()):
+            u[uname.lower()]['email'] = email
+            u[uname.lower()]['uuid'] = uuid
+            u[uname.lower()]['displayName'] = displayName
+            print "looking for %s in %s"%(uname,u)
             logger.warn('%s was found on the Groupwise server but was not requested'%uname)
           logger.warn('No uuid known for user with id %s'
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
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.