Browse Source

unify getUptime implementations and correctly handle None. fixes #116

Natenom/support-murmur-13-1446181288462
Michael Ziegler 14 years ago
parent
commit
35573ed539
  1. 2
      pyweb/mumble/MumbleCtlDbus.py
  2. 4
      pyweb/mumble/MumbleCtlIce.py
  3. 9
      pyweb/mumble/models.py

2
pyweb/mumble/MumbleCtlDbus.py

@ -330,7 +330,7 @@ class MumbleCtlDbus_118(MumbleCtlBase):
return self._getDbusServerObject(srvid).sendMessageChannel( dbus.UInt32(channelid), tree, message )
def getUptime( self, srvid):
return 0
return None
@staticmethod
def convertDbusTypeToNative(data):

4
pyweb/mumble/MumbleCtlIce.py

@ -635,7 +635,7 @@ class MumbleCtlIce_120(MumbleCtlIce_118):
@protectDjangoErrPage
def getUptime(self, srvid):
return 0
return None
class MumbleCtlIce_122(MumbleCtlIce_120):
@ -652,7 +652,7 @@ class MumbleCtlIce_122(MumbleCtlIce_120):
@protectDjangoErrPage
def getUptime(self, srvid):
return self._getIceServerObject(srvid).getUptime()
return None #self._getIceServerObject(srvid).getUptime()
class MumbleCtlIce_123(MumbleCtlIce_120):

9
pyweb/mumble/models.py

@ -303,8 +303,13 @@ class Mumble( models.Model ):
doc="False if a password is needed to join this server." )
uptime = property( lambda self: self.ctl.getUptime(self.srvid),
doc="Number of seconds this instance has been running." )
upsince = property( lambda self: datetime.datetime.fromtimestamp( float( time() - self.uptime ) ),
doc="Datetime since when the server is running." )
@property
def upsince(self):
"""Datetime since when the server is running."""
if self.uptime is not None:
return datetime.datetime.fromtimestamp( float( time() - self.uptime ) )
return None
is_server = True
is_channel = False

Loading…
Cancel
Save