diff options
Diffstat (limited to 'libbe/util/wsgi.py')
-rw-r--r-- | libbe/util/wsgi.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libbe/util/wsgi.py b/libbe/util/wsgi.py index 46e1b3c..cfa43be 100644 --- a/libbe/util/wsgi.py +++ b/libbe/util/wsgi.py @@ -24,6 +24,7 @@ See Also """ import copy +import functools import hashlib import logging import logging.handlers @@ -66,11 +67,6 @@ import libbe.util.http import libbe.util.id -# https://stackoverflow.com/a/56719588/164233 -def cmp(a, b): - return (int(a) > int(b)) - (int(a) < int(b)) - - if libbe.TESTING: import doctest import unittest @@ -95,6 +91,7 @@ class Unauthorized (HandlerError): super(Unauthorized, self).__init__(403, msg, headers) +@functools.total_ordering class User (object): def __init__(self, uname=None, name=None, passhash=None, password=None): self.uname = uname @@ -120,8 +117,11 @@ class User (object): def __str__(self): return ':'.join([self.uname, self.name, self.passhash]) - def __cmp__(self, other): - return cmp(self.uname, other.uname) + def __eq__(self, other): + return self.uname == other.uname + + def __lt__(self, other): + return self.uname < other.uname def hash(self, password): return hashlib.sha1(password).hexdigest() |