From 2f96488aece53929ea91b09544c85442b9af82f5 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 16 Aug 2015 02:28:44 -0400 Subject: [PATCH] Changed the way we call the mongodb so the database match up. --- deployment/public_client.prc | 4 ++-- deployment/server.prc | 2 +- toontown/distributed/ToontownInternalRepository.py | 14 ++++++++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/deployment/public_client.prc b/deployment/public_client.prc index abae39fa..c53b4bc5 100644 --- a/deployment/public_client.prc +++ b/deployment/public_client.prc @@ -3,7 +3,7 @@ # Config.prc should be reproduced here. # Client settings -window-title Toontown Stride +window-title Toontown Stride [Alpha] server-version SERVER_VERSION_HERE video-library-name p3ffmpeg want-dev #f @@ -50,7 +50,7 @@ want-chinese-checkers #t want-checkers #t want-house-types #t want-gifting #t -want-top-toons #f +want-top-toons #t want-language-selection #t estate-day-night #t want-mat-all-tailors #t diff --git a/deployment/server.prc b/deployment/server.prc index 657b5f75..5ff5390a 100644 --- a/deployment/server.prc +++ b/deployment/server.prc @@ -20,7 +20,7 @@ want-chinese-checkers #t want-checkers #t want-house-types #t want-gifting #t -want-top-toons #f +want-top-toons #t want-language-selection #t estate-day-night #t want-mat-all-tailors #t diff --git a/toontown/distributed/ToontownInternalRepository.py b/toontown/distributed/ToontownInternalRepository.py index 40a65d40..327292d2 100755 --- a/toontown/distributed/ToontownInternalRepository.py +++ b/toontown/distributed/ToontownInternalRepository.py @@ -21,13 +21,19 @@ class ToontownInternalRepository(AstronInternalRepository): self.__messenger = ToontownNetMessengerAI(self) if self.wantMongo: import pymongo - self.dbConn = pymongo.MongoClient(config.GetString('mongodb-url', 'localhost')) - self.dbGlobalCursor = self.dbConn.toontownstride - self.dbCursor = self.dbGlobalCursor['air-%d' % self.ourChannel] + mongourl = config.GetString('mongodb-url', 'mongodb://localhost') + replicaset = config.GetString('mongodb-replicaset', '') + db = (urlparse.urlparse(mongourl).path or '/Astron_Dev')[1:] + if replicaset: + self.dbConn = pymongo.MongoClient(mongourl, replicaset=replicaset) + else: + self.dbConn = pymongo.MongoClient(mongourl) + self.database = self.dbConn[db] + self.dbGlobalCursor = self.database.toontownstride else: self.dbConn = None + self.database = None self.dbGlobalCursor = None - self.dbCursor = None def sendNetEvent(self, message, sentArgs=[]): self.__messenger.send(message, sentArgs)