def __new__(cls, *args, **kwargs): if not cls._instance: cls._instance = super(singletonObj, cls).__new__(cls, *args, **kwargs) # only initialized mongoTools once to preserve the DB cursor cls.mt = mongoTools.mongoTools(mc.usr,mc.pw,mc.url,mc.port,mc.dbname) return cls._instance
def __init__(self, request, client_address, server): self.mt = mongoTools.mongoTools(mc.usr,mc.pw,mc.url,mc.port,mc.dbname) SocketServer.StreamRequestHandler.__init__(self, request, client_address, server)