From a7f0bb8da3b0ca0fd993665fa20cfe6a6baf8c25 Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Sun, 25 Apr 2010 22:46:17 +0200 Subject: [PATCH] convert the default port to int and fix displaying the correct port in the admin --- pyweb/mumble/admin.py | 2 +- pyweb/mumble/models.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyweb/mumble/admin.py b/pyweb/mumble/admin.py index 4843444..f66bd9e 100644 --- a/pyweb/mumble/admin.py +++ b/pyweb/mumble/admin.py @@ -67,7 +67,7 @@ class MumbleAdmin(admin.ModelAdmin): def get_port( self, obj ): if not obj.port: - return "< %d >" % (settings.MUMBLE_DEFAULT_PORT + obj.srvid - 1) + return '< %d >' % (obj.server.defaultPort + obj.srvid - 1) return obj.port get_port.short_description = _('Server Port') diff --git a/pyweb/mumble/models.py b/pyweb/mumble/models.py index 9e85c2c..06a53b6 100644 --- a/pyweb/mumble/models.py +++ b/pyweb/mumble/models.py @@ -147,7 +147,7 @@ class MumbleServer( models.Model ): def getDefaultPort( self ): """ Return the default port configured on this server. """ if "port" in self.defaultconf: - return self.defaultconf['port'] + return int(self.defaultconf['port']) else: return settings.MUMBLE_DEFAULT_PORT @@ -162,7 +162,7 @@ class MumbleServer( models.Model ): version = property( getVersion ) prettyversion = property( lambda self: '.'.join( map( str, self.version[:3] ) ), - doc="Pretty-Printed version" ); + doc="Pretty-Printed version" ) class Mumble( models.Model ):