Browse Source

changes to satisfy django-lint.

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
bd151332a5
  1. 81
      pyweb/mumble/models.py

81
pyweb/mumble/models.py

@ -74,42 +74,11 @@ class Mumble( models.Model ):
verbose_name = _('Server instance'); verbose_name = _('Server instance');
verbose_name_plural = _('Server instances'); verbose_name_plural = _('Server instances');
def __init__( self, *args, **kwargs ):
models.Model.__init__( self, *args, **kwargs );
self._ctl = None;
self._channels = None;
self._rootchan = None;
def __unicode__( self ): def __unicode__( self ):
if not self.id: if not self.id:
return u'Murmur "%s" (NOT YET CREATED)' % self.name; return u'Murmur "%s" (NOT YET CREATED)' % self.name;
return u'Murmur "%s" (%d)' % ( self.name, self.srvid ); return u'Murmur "%s" (%d)' % ( self.name, self.srvid );
users_regged = property( lambda self: self.mumbleuser_set.count(), doc="Number of registered users." );
users_online = property( lambda self: len(self.ctl.getPlayers(self.srvid)), doc="Number of online users." );
channel_cnt = property( lambda self: len(self.ctl.getChannels(self.srvid)), doc="Number of channels." );
is_public = property( lambda self: self.passwd == '',
doc="False if a password is needed to join this server." );
is_server = True;
is_channel = False;
is_player = False;
# Ctl instantiation
def getCtl( self ):
"""Instantiate and return a MumbleCtl object for this server.
Only one instance will be created, and reused on subsequent calls.
"""
if not self._ctl:
self._ctl = MumbleCtlBase.newInstance( self.dbus );
return self._ctl;
ctl = property( getCtl, doc="Get a Control object for this server. The ctl is cached for later reuse." );
def save( self, dontConfigureMurmur=False ): def save( self, dontConfigureMurmur=False ):
""" """
Save the options configured in this model instance not only to Django's database, Save the options configured in this model instance not only to Django's database,
@ -177,6 +146,37 @@ class Mumble( models.Model ):
return models.Model.save( self ); return models.Model.save( self );
def __init__( self, *args, **kwargs ):
models.Model.__init__( self, *args, **kwargs );
self._ctl = None;
self._channels = None;
self._rootchan = None;
users_regged = property( lambda self: self.mumbleuser_set.count(), doc="Number of registered users." );
users_online = property( lambda self: len(self.ctl.getPlayers(self.srvid)), doc="Number of online users." );
channel_cnt = property( lambda self: len(self.ctl.getChannels(self.srvid)), doc="Number of channels." );
is_public = property( lambda self: self.passwd == '',
doc="False if a password is needed to join this server." );
is_server = True;
is_channel = False;
is_player = False;
# Ctl instantiation
def getCtl( self ):
"""Instantiate and return a MumbleCtl object for this server.
Only one instance will be created, and reused on subsequent calls.
"""
if not self._ctl:
self._ctl = MumbleCtlBase.newInstance( self.dbus );
return self._ctl;
ctl = property( getCtl, doc="Get a Control object for this server. The ctl is cached for later reuse." );
def configureFromMurmur( self ): def configureFromMurmur( self ):
default = self.ctl.getDefaultConf(); default = self.ctl.getDefaultConf();
conf = self.ctl.getAllConf( self.srvid ); conf = self.ctl.getAllConf( self.srvid );
@ -390,12 +390,12 @@ class MumbleUser( models.Model ):
in Murmur as well, after revoking the user's admin privileges. in Murmur as well, after revoking the user's admin privileges.
""" """
mumbleid = models.IntegerField( _('Mumble player_id'), editable = False, default = -1 );
name = models.CharField( _('User name and Login'), max_length = 200 );
password = models.CharField( _('Login password'), max_length = 200, blank=True );
server = models.ForeignKey( Mumble, verbose_name=_('Server instance') );
owner = models.ForeignKey( User, verbose_name=_('Account owner'), null=True, blank=True );
isAdmin = models.BooleanField( _('Admin on root channel'), default = False );
mumbleid = models.IntegerField( _('Mumble player_id'), editable = False, default = -1 );
name = models.CharField( _('User name and Login'), max_length = 200 );
password = models.CharField( _('Login password'), max_length = 200, blank=True );
server = models.ForeignKey( Mumble, verbose_name=_('Server instance'), related_name="mumbleuser_set" );
owner = models.ForeignKey( User, verbose_name=_('Account owner'), related_name="mumbleuser_set", null=True, blank=True );
isAdmin = models.BooleanField( _('Admin on root channel'), default = False );
class Meta: class Meta:
unique_together = ( ( 'server', 'owner' ), ( 'server', 'mumbleid' ) ); unique_together = ( ( 'server', 'owner' ), ( 'server', 'mumbleid' ) );
@ -406,10 +406,6 @@ class MumbleUser( models.Model ):
is_channel = False; is_channel = False;
is_player = True; is_player = True;
def __init__( self, *args, **kwargs ):
models.Model.__init__( self, *args, **kwargs );
self._registration = None;
def __unicode__( self ): def __unicode__( self ):
return _("Mumble user %(mu)s on %(srv)s owned by Django user %(du)s") % { return _("Mumble user %(mu)s on %(srv)s owned by Django user %(du)s") % {
'mu': self.name, 'mu': self.name,
@ -458,6 +454,9 @@ class MumbleUser( models.Model ):
# Now allow django to save the record set # Now allow django to save the record set
return models.Model.save( self ); return models.Model.save( self );
def __init__( self, *args, **kwargs ):
models.Model.__init__( self, *args, **kwargs );
self._registration = None;
# Admin handlers # Admin handlers
def getAdmin( self ): def getAdmin( self ):

Loading…
Cancel
Save