def switch_channel(self, new_channel): target = self.search(self._card_id, new_channel) if target != None: target._channel_id = self.channel_id else: redis.delete(self.key) self._channel_id = new_channel self.save() target.save()
def delete(self): redis.delete(self.key) self = None