diff options
author | rubenwardy <rw@rubenwardy.com> | 2020-07-09 05:54:39 +0100 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2020-07-09 05:54:39 +0100 |
commit | 000259fc8875e8577500d4e60ba3c5b5898f56d8 (patch) | |
tree | 5def9c8e5093677fc6b321c28d0e17012053efaa | |
parent | 078765fe44de4b923f008595eafc8d16cb8c99f1 (diff) | |
download | cheatdb-000259fc8875e8577500d4e60ba3c5b5898f56d8.tar.xz |
Fix crash on sending notification
-rw-r--r-- | app/utils.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/utils.py b/app/utils.py index 3478f4a..07337b6 100644 --- a/app/utils.py +++ b/app/utils.py @@ -22,7 +22,6 @@ from .models import * from . import app import random, string, os, imghdr from urllib.parse import urljoin -from collections.abc import Iterable def abs_url_for(path, **kwargs): scheme = "https" if app.config["BASE_URL"][:5] == "https" else "http" @@ -191,10 +190,13 @@ def is_package_page(f): def addNotification(target, causer, title, url): - if isinstance(target, Iterable): + try: + iter(target) for x in target: addNotification(x, causer, title, url) return + except TypeError: + pass if target.rank.atLeast(UserRank.NEW_MEMBER) and target != causer: Notification.query.filter_by(user=target, causer=causer, title=title, url=url).delete() |