def del_from_whitelist(): if not env.owner or not env.owner.id: raise NotFound try: res = users.del_from_whitelist(env.owner) except SubscribeError: raise Forbidden if env.request.is_xhr: return Response(json.dumps({"ok": bool(res)}), mimetype="application/json") return Response(redirect=env.request.referer)
def del_from_whitelist(): if not env.owner or not env.owner.id: raise NotFound try: res = users.del_from_whitelist(env.owner) except SubscribeError: raise Forbidden if env.request.is_xhr: return Response(json.dumps({'ok': bool(res)}), mimetype='application/json') return Response(redirect=env.request.referer)
def del_from_whitelist(logins): logins = re.split(r'[\s@,]+', logins.strip(' \t@')) deleted = [] not_deleted = [] not_found = [] for login in logins: try: if users.del_from_whitelist(login): deleted.append(login) else: not_deleted.append(login) except UserNotFound: not_found.append(login) return xmpp_template('wl_updated', deleted=deleted, not_deleted=not_deleted, not_found=not_found)
def del_from_whitelist(login): users.del_from_whitelist(login)