Browse Source

fixed "url" property overwriting RegisterURL field, moved default port number to settings, port no only shows up if not default

Natenom/support-murmur-13-1446181288462
Michael Ziegler 16 years ago
parent
commit
7e25cb7bc1
  1. 9
      pyweb/mumble/mmobjects.py
  2. 9
      pyweb/mumble/models.py
  3. 2
      pyweb/settings.py

9
pyweb/mumble/mmobjects.py

@ -21,7 +21,7 @@ from time import time
from os.path import join
from django.utils.http import urlquote
from django.conf import settings
def cmp_names( a, b ):
return cmp( a.name, b.name );
@ -102,9 +102,12 @@ class mmChannel( object ):
# create a path by joining the channel names
chanpath = join( *chanlist );
return "mumble://%s%s:%d/%s" % ( userstr, self.server.addr, self.server.port, chanpath );
if self.server.port != settings.MUMBLE_DEFAULT_PORT:
return "mumble://%s%s:%d/%s" % ( userstr, self.server.addr, self.server.port, chanpath );
return "mumble://%s%s/%s" % ( userstr, self.server.addr, chanpath );
url = property( getURL, None );
connecturl = property( getURL, None );

9
pyweb/mumble/models.py

@ -111,7 +111,7 @@ class Mumble( models.Model ):
self.ctl.setConf( self.srvid, 'bandwidth', '' );
# registerHostname needs to take the port no into account
if self.port and self.port != 64738:
if self.port and self.port != settings.MUMBLE_DEFAULT_PORT:
self.ctl.setConf( self.srvid, 'registerhostname', "%s:%d" % ( self.addr, self.port ) );
else:
self.ctl.setConf( self.srvid, 'registerhostname', self.addr );
@ -211,9 +211,12 @@ class Mumble( models.Model ):
if forUser is not None:
userstr = "%s@" % forUser.name;
return "mumble://%s%s:%d/" % ( userstr, self.addr, self.port );
if self.port != settings.MUMBLE_DEFAULT_PORT:
return "mumble://%s%s:%d/" % ( userstr, self.addr, self.port );
return "mumble://%s%s/" % ( userstr, self.addr );
url = property( getURL, None );
connecturl = property( getURL, None );

2
pyweb/settings.py

@ -44,9 +44,9 @@ MUMBLE_DJANGO_ROOT = None; ##
# Default email address to send mails from.
DEFAULT_FROM_EMAIL = "webmaster@localhost"
ACCOUNT_ACTIVATION_DAYS = 30
MUMBLE_DEFAULT_PORT = 64738
from os.path import join, dirname, abspath, exists

Loading…
Cancel
Save