def delete(self, nick, network_name): bot = Bot.query.filter(Bot.nick == nick).filter(Bot.network_name == network_name).first() if bot is None: return db.delete(bot) print "Committing deletion of %s, %s" % (nick, network_name) database.commit()
def delete(self, address): server = Server.query.filter(Server.address == address).first() if server is None: return server db.delete(server) print "Committing deletion of %s, %s" % (address) database.commit()
def delete(self, name): #add/get the channel channel = Channel.query.filter(Channel.name == channel_name).first() if channel is None: print "Unable to find channel: %s" % channel_name return #get the bots that reference the channel if(len(channel.bots) > 0): print "Found bots that reference the channel:" for bot in channel.bots: print bot.nick db.delete(channel) #commit database.commit()
def delete(self, network_name, deleteBot = False): network = Network.query.filter(Network.name == network_name).first() if network is None: return #If we found the network then there might be bots that use it bots = Bot.query.filter(Bot.network_name == network_name).all() if(len(bots) > 0): if(not deleteBot): return for bot in bots: print "Deleting %s" % bot.nick db.delete(bot) db.delete(network) print "Committing deletion of %s" % network_name database.commit()
def clean(self): servers = Server.query.filter(Server.network == None).all() for server in servers: db.delete(server) database.commit()