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 14 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. 14
      pyweb/mumble/views.py

2
pyweb/mumble/forms.py

@ -154,7 +154,7 @@ class MumbleServerForm( ModelForm ):
def __init__( self, *args, **kwargs ):
ModelForm.__init__( self, *args, **kwargs )
if self.instance:
if self.instance and self.instance.id:
confstr = ""
conf = self.instance.defaultconf
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 ""
"Project-Id-Version: Mumble-Django v0.8\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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -28,11 +28,11 @@ msgstr ""
msgid "Master is running"
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"
msgstr "Serveradresse"
#: admin.py:66 models.py:134
#: admin.py:66 models.py:165
msgid "Server Port"
msgstr "Serverport"
@ -64,7 +64,7 @@ msgstr "Nein"
msgid "Public"
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"
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."
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."
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!"
msgstr "Kann Account nicht ohne Passwort registrieren!"
#: forms.py:210 models.py:148
#: forms.py:210 models.py:179
msgid "Server Password"
msgstr "Serverpasswort"
@ -130,171 +130,175 @@ msgstr "Admin-Accounts zu verknüpfen ist nicht erlaubt."
msgid "User Texture"
msgstr "Benutzertextur"
#: models.py:62
#: models.py:63
msgid "DBus or ICE base"
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."
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"
msgstr "Ice-Passwort"
#: models.py:67
#: models.py:68
msgid "Mumble Server"
msgstr "Mumble-Server"
#: models.py:68
#: models.py:69
msgid "Mumble Servers"
msgstr "Mumble-Server"
#: models.py:129
#: models.py:160
msgid "Server Name"
msgstr "Servername"
#: models.py:130
#: models.py:161
msgid "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."
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."
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"
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."
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"
msgstr "SuperUser-Passwort"
#: models.py:146
#: models.py:177
msgid "Website URL"
msgstr "URL der Webseite"
#: models.py:147
#: models.py:178
msgid "Welcome Message"
msgstr "Willkommensnachricht"
#: models.py:149
#: models.py:180
msgid "Max. Users"
msgstr "Max. Benutzer"
#: models.py:150
#: models.py:181
msgid "Bandwidth [Bps]"
msgstr "Bandbreite [Bps]"
#: models.py:151
#: models.py:182
msgid "SSL Certificate"
msgstr "SSL-Zertifikat"
#: models.py:152
#: models.py:183
msgid "SSL Key"
msgstr "SSL-Schlüssel"
#: models.py:153
#: models.py:184
msgid "Player name regex"
msgstr "Regex für Spielernamen"
#: models.py:154
#: models.py:185
msgid "Channel name regex"
msgstr "Regex für Channelnamen"
#: models.py:155
#: models.py:186
msgid "Default channel"
msgstr "Standardchannel"
#: models.py:156
#: models.py:187
msgid "Timeout"
msgstr "Timeout"
#: models.py:158
#: models.py:189
msgid "IP Obfuscation"
msgstr "IP-Adressen anonymisieren"
#: models.py:159
#: models.py:190
msgid "Require Certificate"
msgstr "SSL-Zertifikat erzwingen"
#: models.py:160
#: models.py:191
msgid "Maximum length of text messages"
msgstr "Maximale Länge von Textnachrichten"
#: models.py:161
#: models.py:192
msgid "Allow HTML to be used in messages"
msgstr "Erlaube HTML in Nachrichten"
#: models.py:162
#: models.py:193
msgid "Publish this server via Bonjour"
msgstr "Server via Bonjour bekannt machen"
#: models.py:163
#: models.py:194
msgid "Boot Server when Murmur starts"
msgstr "Instanz starten wenn Murmur startet"
#: models.py:181
#: models.py:212
msgid "Boot Server"
msgstr "Server starten"
#: models.py:185 models.py:511
#: models.py:216 models.py:544
msgid "Server instance"
msgstr "Serverinstanz"
#: models.py:186
#: models.py:217
msgid "Server instances"
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."
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"
msgstr "ID des Spielers in Murmur"
#: models.py:509
#: models.py:542
msgid "User name and Login"
msgstr "Benutzername und Login"
#: models.py:510
#: models.py:543
msgid "Login password"
msgstr "Passwort"
#: models.py:512 templates/mumble/mumble.html:293
#: models.py:545 templates/mumble/mumble.html:293
msgid "Account owner"
msgstr "Accountbesitzer"
#: models.py:514
#: models.py:547
msgid "The user's comment."
msgstr "Benutzer-Kommentar"
#: models.py:515
#: models.py:548
msgid "The user's hash."
msgstr "Signatur des Zertifikats"
#: models.py:519
#: models.py:552
msgid "User account"
msgstr "Benutzerkonto"
#: models.py:520
#: models.py:553
msgid "User accounts"
msgstr "Benutzerkonten"
#: models.py:527
#: models.py:560
#, python-format
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"
#: 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
msgid ""
"\n"
@ -509,6 +513,10 @@ msgstr "Speichern"
msgid "Resync with Murmur"
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
msgid "Suppressed"
msgstr "Unterdrückt"

47
pyweb/mumble/models.py

@ -14,7 +14,8 @@
* 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.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." );
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 ):
""" Get a field from the default conf dictionary, or None if the field isn't set. """
if self._conf is None:
@ -99,12 +108,34 @@ class MumbleServer( models.Model ):
def isOnline( self ):
""" 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:
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:
return True;
return True
online = property( isOnline )
defaultconf = property( getDefaultConf, doc="The default config dictionary." )
@ -164,10 +195,10 @@ class Mumble( models.Model ):
def getBooted( self ):
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:
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 %}

14
pyweb/mumble/views.py

@ -84,13 +84,19 @@ def mumbles( request, mobile=False ):
def show( request, server ):
"""Display the channel list for the given Server ID.
""" Display the channel list for the given Server ID.
This includes not only the channel list itself, but indeed the user registration,
server admin and user texture form as well. The template then uses JavaScript
to display these forms integrated into the Channel viewer.
This includes not only the channel list itself, but indeed the user registration,
server admin and user texture form as well. The template then uses JavaScript
to display these forms integrated into the Channel viewer.
"""
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 );

Loading…
Cancel
Save