Browse Source

add properties for new Murmur configuration fields

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
fe7f32103a
  1. 10
      pyweb/mumble/forms.py
  2. 17
      pyweb/mumble/models.py

10
pyweb/mumble/forms.py

@ -86,9 +86,11 @@ class MumbleForm( PropertyModelForm ):
"If on, IP adresses of the clients are not logged.") )
player = forms.CharField( required=False )
channel = forms.CharField( required=False )
defchan = forms.TypedChoiceField( choices=(), coerce=int, required=False, help_text=_(
"Enter the ID of the default channel here. The Channel viewer displays the ID to "
"server admins on the channel detail page.") )
defchan = forms.TypedChoiceField( choices=(), coerce=int, required=False )
timeout = forms.IntegerField( required=False )
certreq = forms.BooleanField( required=False )
textlen = forms.IntegerField( required=False )
html = forms.BooleanField( required=False )
def __init__( self, *args, **kwargs ):
PropertyModelForm.__init__( self, *args, **kwargs )
@ -118,7 +120,7 @@ class MumbleAdminForm( MumbleForm ):
sslcrt = forms.CharField( required=False, widget=forms.Textarea )
sslkey = forms.CharField( required=False, widget=forms.Textarea )
booted = forms.BooleanField( required=False )
bonjour = forms.BooleanField( required=False )
class Meta:
fields = None

17
pyweb/mumble/models.py

@ -49,6 +49,12 @@ def mk_config_property( field, doc="", get_coerce=None, get_none=None, set_coerc
return property( get_field, set_field, doc=doc )
def mk_config_bool_property( field, doc="" ):
return mk_config_property( field, doc=doc,
get_coerce = lambda value: value == "true",
set_coerce = lambda value: str(value).lower()
);
class MumbleServer( models.Model ):
""" Represents a Murmur server installation. """
@ -124,12 +130,13 @@ class Mumble( models.Model ):
player = mk_config_property( "username", "Player name regex" )
channel = mk_config_property( "channelname", "Channel name regex" )
defchan = mk_config_property( "defaultchannel", "Default channel", get_coerce=int )
timeout = mk_config_property( "timeout", "Timeout", get_coerce=int )
obfsc = property(
lambda self: ( self.getConf( "obfuscate" ) == "true" ) if self.id is not None else None,
lambda self, value: self.setConf( "obfuscate", str(value).lower() ),
doc="IP Obfuscation"
)
obfsc = mk_config_bool_property( "obfuscate", "IP Obfuscation" )
certreq = mk_config_bool_property( "certrequired", "Require Certificate" )
textlen = mk_config_bool_property( "textmessagelength", "Maximum length of text messages" )
html = mk_config_bool_property( "allowhtml", "Allow HTML to be used in messages" )
bonjour = mk_config_bool_property( "bonjour", "Publish this server via Bonjour" )
def getBooted( self ):
if self.id is not None:

Loading…
Cancel
Save