From 6234a694070eda6be1fb0010effdeea5fe93c675 Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Thu, 8 Apr 2010 21:21:50 +0200 Subject: [PATCH] read default port from the server's default config instead of relying _only_ on the settings --- pyweb/mumble/models.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pyweb/mumble/models.py b/pyweb/mumble/models.py index 3a89de7..9e85c2c 100644 --- a/pyweb/mumble/models.py +++ b/pyweb/mumble/models.py @@ -144,6 +144,15 @@ class MumbleServer( models.Model ): online = property( isOnline ) defaultconf = property( getDefaultConf, doc="The default config dictionary." ) + def getDefaultPort( self ): + """ Return the default port configured on this server. """ + if "port" in self.defaultconf: + return self.defaultconf['port'] + else: + return settings.MUMBLE_DEFAULT_PORT + + defaultPort = property( getDefaultPort ) + def getVersion( self ): """ Return the version of Murmur. """ if self._version is None: @@ -254,7 +263,7 @@ class Mumble( models.Model ): else: self.ctl.setConf( self.srvid, 'host', '' ); - if self.port and self.port != settings.MUMBLE_DEFAULT_PORT + self.srvid - 1: + if self.port and self.port != self.server.defaultPort + self.srvid - 1: self.ctl.setConf( self.srvid, 'port', str(self.port) ); else: self.ctl.setConf( self.srvid, 'port', '' );