From 97baf5cc60b3b3aec340d2d37ac608d0c6547bd1 Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Wed, 24 Feb 2010 19:10:33 +0100 Subject: [PATCH] only display connect URLs if a sensible address is known --- pyweb/mumble/models.py | 2 ++ pyweb/mumble/templates/mumble/channel.html | 12 +++++++++--- pyweb/mumble/templates/mumble/mumble.html | 4 +++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pyweb/mumble/models.py b/pyweb/mumble/models.py index 61db840..c8a94f8 100644 --- a/pyweb/mumble/models.py +++ b/pyweb/mumble/models.py @@ -414,6 +414,8 @@ class Mumble( models.Model ): def getURL( self, forUser = None ): """ Create an URL of the form mumble://username@host:port/ for this server. """ + if not self.netloc: + return None from urlparse import urlunsplit versionstr = "version=%d.%d.%d" % tuple(self.version[:3]); if forUser is not None: diff --git a/pyweb/mumble/templates/mumble/channel.html b/pyweb/mumble/templates/mumble/channel.html index 5c58c71..fbb89b9 100644 --- a/pyweb/mumble/templates/mumble/channel.html +++ b/pyweb/mumble/templates/mumble/channel.html @@ -6,9 +6,15 @@ {% else %} channel {% endif %} - - {{ Channel.name|trunc:30 }} - + {% if Channel.server.netloc %} + + {{ Channel.name|trunc:30 }} + + {% else %} + + {{ Channel.name|trunc:30 }} + + {% endif %} {% for sub in Channel.subchans %} {% if sub.show %} {{ sub|chanview:MumbleAccount }} diff --git a/pyweb/mumble/templates/mumble/mumble.html b/pyweb/mumble/templates/mumble/mumble.html index 504ebe0..20ee5ad 100644 --- a/pyweb/mumble/templates/mumble/mumble.html +++ b/pyweb/mumble/templates/mumble/mumble.html @@ -21,7 +21,9 @@