Browse Source

fix banning and prevent unwanted erasing of the supw and defaultchannel fields, various minor cleanups.

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
54856fa7f1
  1. 5
      pyweb/mumble/MumbleCtlIce.py
  2. 18
      pyweb/mumble/forms.py
  3. 2
      pyweb/mumble/models.py
  4. 2
      pyweb/mumble/templatetags/mumble_extras.py

5
pyweb/mumble/MumbleCtlIce.py

@ -15,6 +15,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
""" """
from time import time
from functools import wraps from functools import wraps
from StringIO import StringIO from StringIO import StringIO
from os.path import exists, join from os.path import exists, join
@ -527,6 +528,10 @@ class MumbleCtlIce_120(MumbleCtlIce_118):
session = self.getState(srvid, sessionid); session = self.getState(srvid, sessionid);
if "bits" not in kwargs: if "bits" not in kwargs:
kwargs["bits"] = 128; kwargs["bits"] = 128;
if "start" not in kwargs:
kwargs["start"] = int(time());
if "duration" not in kwargs:
kwargs["duration"] = 3600;
return self.addBan(srvid, address=session.address, **kwargs); return self.addBan(srvid, address=session.address, **kwargs);
@protectDjangoErrPage @protectDjangoErrPage

18
pyweb/mumble/forms.py

@ -98,13 +98,17 @@ class MumbleForm( PropertyModelForm ):
# Populate the `default channel' field's choices # Populate the `default channel' field's choices
choices = [ ('', '----------') ] choices = [ ('', '----------') ]
if self.instance and self.instance.srvid is not None and self.instance.booted:
def add_item( item, level ):
if item.is_server or item.is_channel:
choices.append( ( str(item.chanid), ( "-"*level + " " + item.name ) ) )
self.instance.rootchan.visit(add_item)
if self.instance and self.instance.srvid is not None:
if self.instance.booted:
def add_item( item, level ):
if item.is_server or item.is_channel:
choices.append( ( item.chanid, ( "-"*level + " " + item.name ) ) )
self.instance.rootchan.visit(add_item)
else:
current = self.instance.defchan
if current is not None:
choices.append( ( current, "Current value: %d" % current ) )
self.fields['defchan'].choices = choices self.fields['defchan'].choices = choices
class Meta: class Meta:

2
pyweb/mumble/models.py

@ -139,7 +139,7 @@ class Mumble( models.Model ):
"and port fields are used. If display and bind ports are equal, you can omit it here.") ); "and port fields are used. If display and bind ports are equal, you can omit it here.") );
supw = property( lambda self: '', supw = property( lambda self: '',
lambda self, value: self.ctl.setSuperUserPassword( self.srvid, value ),
lambda self, value: ( value and self.ctl.setSuperUserPassword( self.srvid, value ) ) or None,
doc=_('Superuser Password') doc=_('Superuser Password')
) )

2
pyweb/mumble/templatetags/mumble_extras.py

@ -27,7 +27,7 @@ def trunc( string, maxlen = 50 ):
""" converts "a very very extaordinary long text" to "a very very extra... """ """ converts "a very very extaordinary long text" to "a very very extra... """
if len(string) < maxlen: if len(string) < maxlen:
return string; return string;
return string[:(maxlen - 3)] + "...";
return string[:(maxlen - 3)] + "";
@register.filter @register.filter

Loading…
Cancel
Save