Skip to content

Commit 105cc4f

Browse files
committed
[base] Add SmartList sort method
1 parent 37ecbc4 commit 105cc4f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

odml/base.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ def append(self, *obj_tuple):
158158

159159
super(SmartList, self).append(obj)
160160

161+
def sort(self, key=lambda x: x.name, reverse=False):
162+
"""
163+
If not otherwise defined, sort by the *name* attribute
164+
of the lists *_content_type* object.
165+
"""
166+
super(SmartList, self).sort(key=key, reverse=reverse)
167+
161168

162169
@allow_inherit_docstring
163170
class Sectionable(BaseObject):

0 commit comments

Comments
 (0)