From 328d05bdf647effac1cdb444e36a0debb5d93a02 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Wed, 3 Oct 2018 17:06:16 +0100 Subject: Add option to hide non-free packages in API --- app/utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/utils.py') diff --git a/app/utils.py b/app/utils.py index dc65736..cb6a315 100644 --- a/app/utils.py +++ b/app/utils.py @@ -170,3 +170,13 @@ def clearNotifications(url): if current_user.is_authenticated: Notification.query.filter_by(user=current_user, url=url).delete() db.session.commit() + + +YESES = ["yes", "true", "1", "on"] + +def isYes(val): + return val and val.lower() in YESES + + +def isNo(val): + return val and not isYes(val) -- cgit v1.2.3