def unlock(self): if self.is_locked and redis.set(DOOR_LOCK_KEY, 0): self._lock = False return True else: return False
def lock(self): if (self.is_locked == False) and redis.set(DOOR_LOCK_KEY, 1): self._lock = True return True else: return False