diff --git a/ui/medashare/mdb.py b/ui/medashare/mdb.py index 937f244..a477d05 100644 --- a/ui/medashare/mdb.py +++ b/ui/medashare/mdb.py @@ -1,6 +1,7 @@ import base64 import copy import datetime +import functools import itertools import json import unittest @@ -31,6 +32,7 @@ class _TestJSONEncoder(unittest.TestCase): # XXX - add validation # XXX - how to add singletons +@functools.total_ordering class MDBase(object): '''This is a simple wrapper that turns a JSON object into a pythonesc object where attribute accesses work.''' @@ -170,6 +172,10 @@ class MDBase(object): return self._obj + def __lt__(self, o): + return (self['type'], self['uuid'], self['modified']) < \ + (o['type'], o['uuid'], o['modified']) + def __eq__(self, o): return self._obj == o