示例#1
0
 def delUser(self, nick):
     user = User.query.filter(User.nick == nick).first()
     if user is None:
         return
     db.delete(user)
     print "Committing deletion of %s" % user
     self.commit()
示例#2
0
 def delBot(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 add of %s, %s" % (nick, network_name)
     self.commit()
示例#3
0
 def delChannel(self, channel_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
     print "Committing deletion of %s" % channel_name
     self.commit()
示例#4
0
 def delNetwork(self, network_name):
     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:
         print "Found bots that reference the network:"
         for bot in bots:
             print bot.nick
         func_name = raw_input("Delete network and bots? [Y/n]")
         if func_name != "Y" and func_name != "y":
             print "Aborting deletion of %s" % network_name
             return
         for bot in bots:
             print "Deleting %s" % bot.nick
             db.delete(bot)
     db.delete(network)
     print "Committing deletion of %s" % network_name
     self.commit()