def init_database(self):
        database.init_database()

        info = DealerInfo.find(exchange=self.exchange)

        if not info:
            info = DealerInfo.new(self.exchange)
        else:
            print "WARNING, dealer %s already in database" % self.exchange

        info.rooms = 0
        self.info = info
	def init_database(self):
		database.init_database()

		info =	DealerInfo.find(exchange = self.exchange)

		if not info:
			info = DealerInfo.new(self.exchange)
		else:
			print "WARNING, dealer %s already in database" % self.exchange


		info.rooms = 0
		self.info = info
	def find_dealer(self):
		collection = DealerInfo.get_collection()
		dealer = collection.find(sort=[("rooms",1)],limit=1)[0]
		return dealer
 def find_dealer(self):
     collection = DealerInfo.get_collection()
     dealer = collection.find(sort=[("rooms", 1)], limit=1)[0]
     return dealer