X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=motion.py;h=e878616065ba72baabbe532636179aa909949eac;hb=07f80f37659dd3fc0abd112ab6f0fe350ef47ade;hp=5291469f8eaa35a5e8fe310bb6743f1f5d6ce1f2;hpb=f87b033c4ef50f5dc3a20e28083339cf2bab29d8;p=motion.git diff --git a/motion.py b/motion.py index 5291469..e878616 100644 --- a/motion.py +++ b/motion.py @@ -39,6 +39,7 @@ class default_settings(object): COPYRIGHTLINK="https://wpia.club" IMPRINTLINK="https://documents.wpia.club/imprint.html" DATAPROTECTIONLINK="https://documents.wpia.club/data_privacy_policy_html_pages_en.html" + MAX_PROXY=2 # Load config @@ -371,7 +372,7 @@ def show_motion(motion): if may("audit", resultmotion[0].get("type")) and not resultmotion[0].get("running") and not resultmotion[0].get("canceled"): votes = get_db().prepare("SELECT vote.result, voter.email FROM vote INNER JOIN voter ON voter.id = vote.voter_id WHERE vote.motion_id=$1")(resultmotion[0].get("id")); votes = get_db().prepare("SELECT vote.result, voter.email, CASE voter.email WHEN proxy.email THEN NULL ELSE proxy.email END as proxyemail FROM vote INNER JOIN voter ON voter.id = vote.voter_id INNER JOIN voter as proxy ON proxy.id = vote.proxy_id WHERE vote.motion_id=$1")(resultmotion[0].get("id")); - return render_template('single_motion.html', motion=resultmotion[0], may_vote=may("vote", resultmotion[0].get("type")), may_cancel=may("cancel", resultmotion[0].get("type")), votes=votes, proxyvote=resultproxyvote, proxyname=resultproxyname, languages=get_languages()) + return render_template('single_motion.html', motion=resultmotion[0], may_vote=may("vote", resultmotion[0].get("type")), may_cancel=may("cancel", resultmotion[0].get("type")), may_finish=may("finish", resultmotion[0].get("type")), votes=votes, proxyvote=resultproxyvote, proxyname=resultproxyname, languages=get_languages()) @app.route("/motion//vote/", methods=['POST']) @validate_motion_access_vote('vote') @@ -421,7 +422,7 @@ def add_proxy(): return _('Error, proxy allready given.'), 400 rv = get_db().prepare("SELECT COUNT(id) as c FROM proxy WHERE proxy_id=$1 AND revoked is NULL GROUP BY proxy_id")(proxyid); if len(rv) != 0: - if rv[0].get("c") >= max_proxy: + if rv[0].get("c") is None or rv[0].get("c") >= max_proxy: return _("Error, Max proxy for '%s' reached.") % (proxy), 400 rv = get_db().prepare("INSERT INTO proxy(voter_id, proxy_id, granted_by) VALUES ($1,$2,$3)")(voterid, proxyid, g.voter) return rel_redirect("/proxy") @@ -452,8 +453,8 @@ def create_user(email): db = get_db() with db.xact(): rv = db.prepare("SELECT id FROM voter WHERE lower(email)=lower($1)")(email) - messagetext="User '%s' already exists." % (email) + messagetext=_("User '%s' already exists.") % (email) if len(rv) == 0: db.prepare("INSERT INTO voter(\"email\") VALUES($1)")(email) - messagetext="User '%s' inserted." % (email) + messagetext=_("User '%s' inserted.") % (email) click.echo(messagetext)