def discover_active_zone(): __active_zoneLock.acquire() global active_zone active_zone = raumfeld.getZoneByUDN(active_zone_udn) if active_zone == None: active_zone = raumfeld.getZones()[0] sleep(2) __active_zoneLock.release() return active_zone
def __getSingleZone(name_udn): """Tries to find the first occurring Zone with the specified name or UDN""" zone = None if (name_udn.startswith("uuid:")): zone = raumfeld.getZoneByUDN(name_udn) else: zones = raumfeld.getZonesByName(name_udn.decode('utf-8')) if (len(zones) > 0): zone = zones[0] return zone
def zone(udn): """Change active zone by UDN""" global active_zone_udn zone = raumfeld.getZoneByUDN(udn) if zone != None: active_zone_udn = udn else: zones = raumfeld.getZones() zone = zones[0] active_zone_udn = zone.UDN with open('active_zone_udn', 'w') as f: f.write(active_zone_udn) sleep(ctct_sleep) discover_active_zone() redirect('/ctct')