]> de.git.xonotic.org Git - xonotic/xonstat.git/blobdiff - xonstat/models/map.py
Remove Persona since it was shut down. :(
[xonotic/xonstat.git] / xonstat / models / map.py
index 176e23f8d883e5aed0c09574323ae34f17c5081b..5549559f5d42a23da9da63242396a326d970a1ca 100644 (file)
@@ -4,10 +4,11 @@ Models related to maps.
 
 from calendar import timegm
 
+from xonstat.models.mixins import FuzzyDateMixin, EpochMixin
 from xonstat.util import pretty_date, strip_colors, html_colors
 
 
-class Map(object):
+class Map(FuzzyDateMixin, EpochMixin):
     """
     A playable map. Roughly equivalent to a pk3 file, but distinguished by name instead.
     """
@@ -16,7 +17,7 @@ class Map(object):
         self.name = name
 
     def __repr__(self):
-        return "<Map({}, {}, {})>".format(self.map_id, self.name, self.version)
+        return "<Map({0.map_id}, {0.name}, {0.version})>".format(self)
 
     def to_dict(self):
         return {
@@ -25,12 +26,6 @@ class Map(object):
             'version': self.version,
         }
 
-    def fuzzy_date(self):
-        return pretty_date(self.create_dt)
-
-    def epoch(self):
-        return timegm(self.create_dt.timetuple())
-
 
 # TODO: investigate if this model is truly a model, or really just a query (i.e. namedtuple)
 class MapCapTime(object):