implement __lt__ to support sorting a list of objects

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
remotes/origin/feature_files_export
Steven Armstrong 14 years ago
parent bf1b995908
commit 70ee0f1681
  1. 4
      lib/cdist/core/object.py

@ -115,6 +115,10 @@ class Object(object):
"""define equality as 'attributes are the same'"""
return self.__dict__ == other.__dict__
def __lt__(self, other):
return isinstance(other, self.__class__) and self.name < other.name
# FIXME: still needed?
@property
def explorer_path(self):

Loading…
Cancel
Save