Avoid relying on int vs None comparison

Python 3 doesn't support comparing None to ints
This commit is contained in:
Erik Johnston 2018-07-02 11:39:28 +01:00
parent cbf82dddf1
commit 2c33b55738

View file

@ -525,7 +525,11 @@ def _check_power_levels(event, auth_events):
"to your own" "to your own"
) )
if old_level > user_level or new_level > user_level: # Check if the old and new levels are greater than the user level
# (if defined)
old_level_too_big = old_level is not None and old_level > user_level
new_level_too_big = new_level is not None and new_level > user_level
if old_level_too_big or new_level_too_big:
raise AuthError( raise AuthError(
403, 403,
"You don't have permission to add ops level greater " "You don't have permission to add ops level greater "