fix exception when iterating grouped devices
authorStefan Kögl <stefan@skoegl.net>
Sat, 27 Apr 2013 12:10:54 +0000 (27 14:10 +0200)
committerStefan Kögl <stefan@skoegl.net>
Sat, 27 Apr 2013 12:10:54 +0000 (27 14:10 +0200)
mygpo/users/sync.py

index 115f83a..f1ddf60 100644 (file)
@@ -24,9 +24,14 @@ class SyncedDevicesMixin(DocumentSchema):
 
         for group in self.sync_groups:
 
+            devices = [indexed_devices.pop(device_id, None) for device_id in group]
+            devices = filter(None, devices)
+            if not devices:
+                continue
+
             yield GroupedDevices(
                     True,
-                    [indexed_devices.pop(device_id) for device_id in group]
+                    devices
                 )
 
         # un-synced devices