]> WPIA git - motion.git/commitdiff
Merge remote-tracking branch 'gitlab/master' into unittest-fix
authorFelix Dörre <felix@dogcraft.de>
Wed, 23 Dec 2020 15:21:28 +0000 (16:21 +0100)
committerFelix Dörre <felix@dogcraft.de>
Wed, 23 Dec 2020 15:21:28 +0000 (16:21 +0100)
1  2 
motion.py

diff --combined motion.py
index 23d91f59ca1074e7e361f76dd8ec1dc763e5ca1a,e878616065ba72baabbe532636179aa909949eac..d0526b523faf0f1af86b5ca0859f879a8927385d
+++ b/motion.py
@@@ -29,7 -29,6 +29,7 @@@ gettext.install('motion'
  class EscapeHtml(Extension):
      def extendMarkdown(self, md, md_globals):
          del md.preprocessors['html_block']
 +        del md.postprocessors['raw_html']
          del md.inlinePatterns['html']
  
  md = Markdown(app, extensions=[EscapeHtml()])
@@@ -297,10 -296,7 +297,10 @@@ def put_motion()
          if len(sr) == 0 or sr[0][0] is None:
              ident=prefix.per_host[cat]+"."+t.strftime("%Y%m%d")+".001"
          else:
 -            ident=prefix.per_host[cat]+"."+t.strftime("%Y%m%d")+"."+("%03d" % (int(sr[0][0].split(".")[2])+1))
 +            nextId = int(sr[0][0].split(".")[2])+1
 +            if nextId >= 1000:
 +                return _('Too many motions for this day'), 500
 +            ident=prefix.per_host[cat]+"."+t.strftime("%Y%m%d")+"."+("%03d" % nextId)
          p = db.prepare("INSERT INTO motion(\"name\", \"content\", \"deadline\", \"posed_by\", \"type\", \"identifier\", \"host\") VALUES($1, $2, CURRENT_TIMESTAMP + $3 * interval '1 days', $4, $5, $6, $7)")
          p(title, content, time, g.voter, cat, ident, request.host)
      return rel_redirect("/")
@@@ -376,7 -372,7 +376,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/<string:motion>/vote/<string:voter>", methods=['POST'])
  @validate_motion_access_vote('vote')