Models related to servers.
"""
-from calendar import timegm
from datetime import datetime as dt
-from xonstat.util import pretty_date
+from xonstat.models.mixins import FuzzyDateMixin, EpochMixin
-class Server(object):
+class Server(FuzzyDateMixin, EpochMixin):
"""
A Xonotic server, identifiable by name and (when there's a conflict) hashkey.
"""
- def __init__(self, name=None, hashkey=None, ip_addr=None):
+ def __init__(self, name=None, hashkey=None, ip_addr=None, elo_ind=None):
self.name = name
self.hashkey = hashkey
self.ip_addr = ip_addr
+ self.elo_ind = elo_ind if elo_ind is not None else True
self.create_dt = dt.utcnow()
def __repr__(self):
'ip_addr': self.ip_addr,
'location': self.location,
}
-
- def fuzzy_date(self):
- return pretty_date(self.create_dt)
-
- def epoch(self):
- return timegm(self.create_dt.timetuple())
\ No newline at end of file