From b4679528b91d21f52759cae162651fff690bc739 Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Thu, 11 Mar 2010 09:51:18 +0100 Subject: [PATCH] don't try to display the default config when the server is offline; german language update --- pyweb/mumble/forms.py | 13 ++++++++----- pyweb/mumble/models.py | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pyweb/mumble/forms.py b/pyweb/mumble/forms.py index 15f6d8e..b55cc5f 100644 --- a/pyweb/mumble/forms.py +++ b/pyweb/mumble/forms.py @@ -155,11 +155,14 @@ class MumbleServerForm( ModelForm ): ModelForm.__init__( self, *args, **kwargs ) if self.instance and self.instance.id: - confstr = "" - conf = self.instance.defaultconf - for field in conf: - confstr += "%s: %s\n" % ( field, conf[field] ) - self.fields["defaultconf"].initial = confstr + if self.instance.online: + confstr = "" + conf = self.instance.defaultconf + for field in conf: + confstr += "%s: %s\n" % ( field, conf[field] ) + self.fields["defaultconf"].initial = confstr + else: + self.fields["defaultconf"].initial = _("This server is currently offline.") class Meta: model = MumbleServer diff --git a/pyweb/mumble/models.py b/pyweb/mumble/models.py index 4154509..58b62f7 100644 --- a/pyweb/mumble/models.py +++ b/pyweb/mumble/models.py @@ -210,6 +210,7 @@ class Mumble( models.Model ): self.ctl.stop( self.srvid ); booted = property( getBooted, setBooted, doc=ugettext_noop("Boot Server") ) + online = property( getBooted, setBooted, doc=ugettext_noop("Boot Server") ) class Meta: unique_together = ( ( 'server', 'srvid' ), );