Browse Source

DRASTICALLY improve the way MD handles servers being offline, unavailable modules and configuration issues. fixes #86

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
f878fb565c
  1. 2
      pyweb/mumble/forms.py
  2. BIN
      pyweb/mumble/locale/de/LC_MESSAGES/django.mo
  3. 106
      pyweb/mumble/locale/de/LC_MESSAGES/django.po
  4. 47
      pyweb/mumble/models.py
  5. 14
      pyweb/mumble/templates/mumble/offline.html
  6. 6
      pyweb/mumble/views.py

2
pyweb/mumble/forms.py

@ -154,7 +154,7 @@ class MumbleServerForm( ModelForm ):
def __init__( self, *args, **kwargs ): def __init__( self, *args, **kwargs ):
ModelForm.__init__( self, *args, **kwargs ) ModelForm.__init__( self, *args, **kwargs )
if self.instance:
if self.instance and self.instance.id:
confstr = "" confstr = ""
conf = self.instance.defaultconf conf = self.instance.defaultconf
for field in conf: for field in conf:

BIN
pyweb/mumble/locale/de/LC_MESSAGES/django.mo

106
pyweb/mumble/locale/de/LC_MESSAGES/django.po

@ -16,8 +16,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Mumble-Django v0.8\n" "Project-Id-Version: Mumble-Django v0.8\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-03-08 18:05+0100\n"
"PO-Revision-Date: 2010-03-08 18:07\n"
"POT-Creation-Date: 2010-03-11 09:40+0100\n"
"PO-Revision-Date: 2010-03-11 09:41\n"
"Last-Translator: <de@de.de>\n" "Last-Translator: <de@de.de>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
@ -28,11 +28,11 @@ msgstr ""
msgid "Master is running" msgid "Master is running"
msgstr "Serverprozess läuft" msgstr "Serverprozess läuft"
#: admin.py:59 models.py:131 templates/mumble/mumble.html:28
#: admin.py:59 models.py:162 templates/mumble/mumble.html:28
msgid "Server Address" msgid "Server Address"
msgstr "Serveradresse" msgstr "Serveradresse"
#: admin.py:66 models.py:134
#: admin.py:66 models.py:165
msgid "Server Port" msgid "Server Port"
msgstr "Serverport" msgstr "Serverport"
@ -64,7 +64,7 @@ msgstr "Nein"
msgid "Public" msgid "Public"
msgstr "Öffentlich" msgstr "Öffentlich"
#: admin.py:132 models.py:595 templates/mumble/mumble.html:223
#: admin.py:132 models.py:625 templates/mumble/mumble.html:223
msgid "Admin on root channel" msgid "Admin on root channel"
msgstr "Admin im Wurzelkanal" msgstr "Admin im Wurzelkanal"
@ -85,15 +85,15 @@ msgstr "Portnummer %(portno)d liegt nicht in %(minrange)d - %(maxrange)d"
msgid "That name is forbidden by the server." msgid "That name is forbidden by the server."
msgstr "Dieser Name wird vom Server nicht erlaubt." msgstr "Dieser Name wird vom Server nicht erlaubt."
#: forms.py:190 models.py:550
#: forms.py:190 models.py:581
msgid "Another player already registered that name." msgid "Another player already registered that name."
msgstr "Ein anderer Spieler hat sich unter diesem Namen bereits registriert." msgstr "Ein anderer Spieler hat sich unter diesem Namen bereits registriert."
#: forms.py:198 forms.py:304 models.py:552
#: forms.py:198 forms.py:304 models.py:583
msgid "Cannot register player without a password!" msgid "Cannot register player without a password!"
msgstr "Kann Account nicht ohne Passwort registrieren!" msgstr "Kann Account nicht ohne Passwort registrieren!"
#: forms.py:210 models.py:148
#: forms.py:210 models.py:179
msgid "Server Password" msgid "Server Password"
msgstr "Serverpasswort" msgstr "Serverpasswort"
@ -130,171 +130,175 @@ msgstr "Admin-Accounts zu verknüpfen ist nicht erlaubt."
msgid "User Texture" msgid "User Texture"
msgstr "Benutzertextur" msgstr "Benutzertextur"
#: models.py:62
#: models.py:63
msgid "DBus or ICE base" msgid "DBus or ICE base"
msgstr "DBus- oder ICE-String" msgstr "DBus- oder ICE-String"
#: models.py:63
#: models.py:64
msgid "Examples: 'net.sourceforge.mumble.murmur' for DBus or 'Meta:tcp -h 127.0.0.1 -p 6502' for Ice." msgid "Examples: 'net.sourceforge.mumble.murmur' for DBus or 'Meta:tcp -h 127.0.0.1 -p 6502' for Ice."
msgstr "Beispiele: 'net.sourceforge.mumble.murmur' für DBus oder 'Meta:tcp -h 127.0.0.1 -p 6502' für Ice." msgstr "Beispiele: 'net.sourceforge.mumble.murmur' für DBus oder 'Meta:tcp -h 127.0.0.1 -p 6502' für Ice."
#: models.py:64
#: models.py:65
msgid "Ice Secret" msgid "Ice Secret"
msgstr "Ice-Passwort" msgstr "Ice-Passwort"
#: models.py:67
#: models.py:68
msgid "Mumble Server" msgid "Mumble Server"
msgstr "Mumble-Server" msgstr "Mumble-Server"
#: models.py:68
#: models.py:69
msgid "Mumble Servers" msgid "Mumble Servers"
msgstr "Mumble-Server" msgstr "Mumble-Server"
#: models.py:129
#: models.py:160
msgid "Server Name" msgid "Server Name"
msgstr "Servername" msgstr "Servername"
#: models.py:130
#: models.py:161
msgid "Server ID" msgid "Server ID"
msgstr "Server-ID" msgstr "Server-ID"
#: models.py:132
#: models.py:163
msgid "Hostname or IP address to bind to. You should use a hostname here, because it will appear on the global server list." msgid "Hostname or IP address to bind to. You should use a hostname here, because it will appear on the global server list."
msgstr "Hostname oder IP-Adresse unter der der Server erreichbar sein soll. Du solltest einen Hostname verwenden, da dieses Feld in der globalen Serverliste erscheint." msgstr "Hostname oder IP-Adresse unter der der Server erreichbar sein soll. Du solltest einen Hostname verwenden, da dieses Feld in der globalen Serverliste erscheint."
#: models.py:135
#: models.py:166
msgid "Port number to bind to. Leave empty to auto assign one." msgid "Port number to bind to. Leave empty to auto assign one."
msgstr "Portnummer auf die gebunden werden soll. Lasse das Feld leer um automatisch eine zuzuweisen." msgstr "Portnummer auf die gebunden werden soll. Lasse das Feld leer um automatisch eine zuzuweisen."
#: models.py:136
#: models.py:167
msgid "Server Display Address" msgid "Server Display Address"
msgstr "Angezeigte Adresse" msgstr "Angezeigte Adresse"
#: models.py:137
#: models.py:168
msgid "This field is only relevant if you are located behind a NAT, and names the Hostname or IP address to use in the Channel Viewer and for the global server list registration. If not given, the addr and port fields are used. If display and bind ports are equal, you can omit it here." msgid "This field is only relevant if you are located behind a NAT, and names the Hostname or IP address to use in the Channel Viewer and for the global server list registration. If not given, the addr and port fields are used. If display and bind ports are equal, you can omit it here."
msgstr "Dieses Feld ist nur relevant wenn der Server hinter einem NAT steht, und gibt dann den Hostnamen oder die IP-Adresse die im Channel-Viewer und für die Registrierung in der Serverliste benutzt werden soll. Ist dieses Feld leer, werden die Angaben Addresse und Port stattdessen benutzt. Wenn die Ports identisch sind, kannst du den Port hier weglassen." msgstr "Dieses Feld ist nur relevant wenn der Server hinter einem NAT steht, und gibt dann den Hostnamen oder die IP-Adresse die im Channel-Viewer und für die Registrierung in der Serverliste benutzt werden soll. Ist dieses Feld leer, werden die Angaben Addresse und Port stattdessen benutzt. Wenn die Ports identisch sind, kannst du den Port hier weglassen."
#: models.py:143
#: models.py:174
msgid "Superuser Password" msgid "Superuser Password"
msgstr "SuperUser-Passwort" msgstr "SuperUser-Passwort"
#: models.py:146
#: models.py:177
msgid "Website URL" msgid "Website URL"
msgstr "URL der Webseite" msgstr "URL der Webseite"
#: models.py:147
#: models.py:178
msgid "Welcome Message" msgid "Welcome Message"
msgstr "Willkommensnachricht" msgstr "Willkommensnachricht"
#: models.py:149
#: models.py:180
msgid "Max. Users" msgid "Max. Users"
msgstr "Max. Benutzer" msgstr "Max. Benutzer"
#: models.py:150
#: models.py:181
msgid "Bandwidth [Bps]" msgid "Bandwidth [Bps]"
msgstr "Bandbreite [Bps]" msgstr "Bandbreite [Bps]"
#: models.py:151
#: models.py:182
msgid "SSL Certificate" msgid "SSL Certificate"
msgstr "SSL-Zertifikat" msgstr "SSL-Zertifikat"
#: models.py:152
#: models.py:183
msgid "SSL Key" msgid "SSL Key"
msgstr "SSL-Schlüssel" msgstr "SSL-Schlüssel"
#: models.py:153
#: models.py:184
msgid "Player name regex" msgid "Player name regex"
msgstr "Regex für Spielernamen" msgstr "Regex für Spielernamen"
#: models.py:154
#: models.py:185
msgid "Channel name regex" msgid "Channel name regex"
msgstr "Regex für Channelnamen" msgstr "Regex für Channelnamen"
#: models.py:155
#: models.py:186
msgid "Default channel" msgid "Default channel"
msgstr "Standardchannel" msgstr "Standardchannel"
#: models.py:156
#: models.py:187
msgid "Timeout" msgid "Timeout"
msgstr "Timeout" msgstr "Timeout"
#: models.py:158
#: models.py:189
msgid "IP Obfuscation" msgid "IP Obfuscation"
msgstr "IP-Adressen anonymisieren" msgstr "IP-Adressen anonymisieren"
#: models.py:159
#: models.py:190
msgid "Require Certificate" msgid "Require Certificate"
msgstr "SSL-Zertifikat erzwingen" msgstr "SSL-Zertifikat erzwingen"
#: models.py:160
#: models.py:191
msgid "Maximum length of text messages" msgid "Maximum length of text messages"
msgstr "Maximale Länge von Textnachrichten" msgstr "Maximale Länge von Textnachrichten"
#: models.py:161
#: models.py:192
msgid "Allow HTML to be used in messages" msgid "Allow HTML to be used in messages"
msgstr "Erlaube HTML in Nachrichten" msgstr "Erlaube HTML in Nachrichten"
#: models.py:162
#: models.py:193
msgid "Publish this server via Bonjour" msgid "Publish this server via Bonjour"
msgstr "Server via Bonjour bekannt machen" msgstr "Server via Bonjour bekannt machen"
#: models.py:163
#: models.py:194
msgid "Boot Server when Murmur starts" msgid "Boot Server when Murmur starts"
msgstr "Instanz starten wenn Murmur startet" msgstr "Instanz starten wenn Murmur startet"
#: models.py:181
#: models.py:212
msgid "Boot Server" msgid "Boot Server"
msgstr "Server starten" msgstr "Server starten"
#: models.py:185 models.py:511
#: models.py:216 models.py:544
msgid "Server instance" msgid "Server instance"
msgstr "Serverinstanz" msgstr "Serverinstanz"
#: models.py:186
#: models.py:217
msgid "Server instances" msgid "Server instances"
msgstr "Serverinstanzen" msgstr "Serverinstanzen"
#: models.py:471 models.py:654
#: models.py:504 models.py:684
msgid "This field must not be updated once the record has been saved." msgid "This field must not be updated once the record has been saved."
msgstr "Dieses Feld darf nicht mehr verändert werden, nachdem der Eintrag zum ersten Mal gespeichert wurde." msgstr "Dieses Feld darf nicht mehr verändert werden, nachdem der Eintrag zum ersten Mal gespeichert wurde."
#: models.py:508
#: models.py:541
msgid "Mumble player_id" msgid "Mumble player_id"
msgstr "ID des Spielers in Murmur" msgstr "ID des Spielers in Murmur"
#: models.py:509
#: models.py:542
msgid "User name and Login" msgid "User name and Login"
msgstr "Benutzername und Login" msgstr "Benutzername und Login"
#: models.py:510
#: models.py:543
msgid "Login password" msgid "Login password"
msgstr "Passwort" msgstr "Passwort"
#: models.py:512 templates/mumble/mumble.html:293
#: models.py:545 templates/mumble/mumble.html:293
msgid "Account owner" msgid "Account owner"
msgstr "Accountbesitzer" msgstr "Accountbesitzer"
#: models.py:514
#: models.py:547
msgid "The user's comment." msgid "The user's comment."
msgstr "Benutzer-Kommentar" msgstr "Benutzer-Kommentar"
#: models.py:515
#: models.py:548
msgid "The user's hash." msgid "The user's hash."
msgstr "Signatur des Zertifikats" msgstr "Signatur des Zertifikats"
#: models.py:519
#: models.py:552
msgid "User account" msgid "User account"
msgstr "Benutzerkonto" msgstr "Benutzerkonto"
#: models.py:520
#: models.py:553
msgid "User accounts" msgid "User accounts"
msgstr "Benutzerkonten" msgstr "Benutzerkonten"
#: models.py:527
#: models.py:560
#, python-format #, python-format
msgid "Mumble user %(mu)s on %(srv)s owned by Django user %(du)s" msgid "Mumble user %(mu)s on %(srv)s owned by Django user %(du)s"
msgstr "Benutzeraccount %(mu)s auf %(srv)s mit Besitzer %(du)s" msgstr "Benutzeraccount %(mu)s auf %(srv)s mit Besitzer %(du)s"
#: templates/mumble/list.html:20
msgid "No server instances have been configured yet."
msgstr "Es sind noch keine Serverinstanzen konfiguriert."
#: templates/mumble/mumble.html:16 #: templates/mumble/mumble.html:16
msgid "" msgid ""
"\n" "\n"
@ -509,6 +513,10 @@ msgstr "Speichern"
msgid "Resync with Murmur" msgid "Resync with Murmur"
msgstr "Liste neu laden" msgstr "Liste neu laden"
#: templates/mumble/offline.html:12
msgid "This server is currently offline."
msgstr "Dieser Server ist im Moment nicht erreichbar."
#: templates/mumble/player.html:15 #: templates/mumble/player.html:15
msgid "Suppressed" msgid "Suppressed"
msgstr "Unterdrückt" msgstr "Unterdrückt"

47
pyweb/mumble/models.py

@ -14,7 +14,8 @@
* GNU General Public License for more details. * GNU General Public License for more details.
""" """
import socket, Ice
import socket, Ice, re
from sys import stderr
from django.utils.translation import ugettext_noop, ugettext_lazy as _ from django.utils.translation import ugettext_noop, ugettext_lazy as _
from django.contrib.auth.models import User from django.contrib.auth.models import User
@ -87,6 +88,14 @@ class MumbleServer( models.Model ):
ctl = property( getCtl, doc="Get a Control object for this server. The ctl is cached for later reuse." ); ctl = property( getCtl, doc="Get a Control object for this server. The ctl is cached for later reuse." );
def isMethodDbus(self):
""" Return true if this instance uses DBus. """
rd = re.compile( r'^(\w+\.)*\w+$' );
return bool(rd.match(self.dbus))
method_dbus = property( isMethodDbus )
method_ice = property( lambda self: not self.isMethodDbus(), doc="Return true if this instance uses Ice." )
def getDefaultConf( self, field=None ): def getDefaultConf( self, field=None ):
""" Get a field from the default conf dictionary, or None if the field isn't set. """ """ Get a field from the default conf dictionary, or None if the field isn't set. """
if self._conf is None: if self._conf is None:
@ -99,12 +108,34 @@ class MumbleServer( models.Model ):
def isOnline( self ): def isOnline( self ):
""" Return true if this server process is running. """ """ Return true if this server process is running. """
possibleexceptions = []
try:
from Ice import ConnectionRefusedException
except ImportError, err:
if self.method_ice:
print >> stderr, err
return None
else:
possibleexceptions.append( ConnectionRefusedException )
try:
from dbus import DBusException
except ImportError, err:
if self.method_dbus:
print >> stderr, err
return None
else:
possibleexceptions.append( DBusException )
try: try:
self.ctl self.ctl
except Ice.ConnectionRefusedException:
return False;
except tuple(possibleexceptions), err:
print >> stderr, err
return False
except (EnvironmentError, RuntimeError), err:
print >> stderr, err
return None
else: else:
return True;
return True
online = property( isOnline ) online = property( isOnline )
defaultconf = property( getDefaultConf, doc="The default config dictionary." ) defaultconf = property( getDefaultConf, doc="The default config dictionary." )
@ -164,10 +195,10 @@ class Mumble( models.Model ):
def getBooted( self ): def getBooted( self ):
if self.id is not None: if self.id is not None:
try:
return self.ctl.isBooted( self.srvid );
except Ice.ConnectionRefusedException:
return False;
if self.server.online:
return self.ctl.isBooted( self.srvid )
else:
return None
else: else:
return False return False

14
pyweb/mumble/templates/mumble/offline.html

@ -0,0 +1,14 @@
{% extends "index.html" %}
{% comment %}
<!-- kate: space-indent on; indent-width 2; replace-tabs on; -->
{% endcomment %}
{% load i18n %}
{% load mumble_extras %}
{% block Headline %}
{{ DBaseObject.name }}
{% endblock %}
{% block Content %}
<div class="rahmen">
{% trans "This server is currently offline." %}
</div>
{% endblock %}

6
pyweb/mumble/views.py

@ -91,6 +91,12 @@ def show( request, server ):
to display these forms integrated into the Channel viewer. to display these forms integrated into the Channel viewer.
""" """
srv = get_object_or_404( Mumble, id=server ); srv = get_object_or_404( Mumble, id=server );
if not srv.booted:
return render_to_response(
'mumble/offline.html',
{ 'DBaseObject': srv,
'MumbleActive': True,
}, context_instance = RequestContext(request) );
isAdmin = srv.isUserAdmin( request.user ); isAdmin = srv.isUserAdmin( request.user );

Loading…
Cancel
Save