From e80cb442e4ec254c0a2e244315a1ff0d1f7a274f Mon Sep 17 00:00:00 2001 From: Flancian <0@flancia.org> Date: Tue, 5 Jan 2021 12:15:55 +0100 Subject: [PATCH] Make nodes comparable (yikes). --- app/db.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/db.py b/app/db.py index 580423b..778b75b 100644 --- a/app/db.py +++ b/app/db.py @@ -109,6 +109,12 @@ class Node: self.url = '/node/' + self.uri self.subnodes = [] + def __lt__(self, other): + return self.wikilink.lower() < other.wikilink.lower() + + def __gt__(self, other): + return self.wikilink.lower() > other.wikilink.lower() + def size(self): return len(self.subnodes)