id,summary,reporter,owner,description,type,status,priority,component,severity,resolution,keywords,cc,release 10703,[PATCH] support of fully anonymous polls,falkb,,"This patch adds the ability to make fully anonymous polls, simply by the use of pattern {{{ (*) }}} at the end of the poll question: {{{ #!diff Index: pollmacro/trunk/tracpoll/tracpoll.py =================================================================== --- pollmacro/trunk/tracpoll/tracpoll.py (revision 11672) +++ pollmacro/trunk/tracpoll/tracpoll.py (working copy) @@ -1,3 +1,4 @@ +import hashlib import os import re import pickle @@ -49,7 +50,7 @@ finally: fd.close() - def populate(self, req): + def populate(self, req, isAnonymousPoll): """""" Update poll based on HTTP request. """""" if req.args.get('poll', '') == self.key: vote = req.args.get('vote', '') @@ -58,13 +59,15 @@ if vote not in self.votes: raise TracError('No such vote %s' % vote) username = req.authname or 'anonymous' + if isAnonymousPoll: + username = hashlib.sha1(username).hexdigest() for v, voters in self.votes.items(): if username in voters: self.votes[v].remove(username) self.votes[vote] = self.votes[vote] + [username] self.save() - def render(self, env, req): + def render(self, env, req, isAnonymousPoll): out = StringIO() can_vote = req.perm.has_permission('POLL_VOTE') if can_vote: @@ -76,6 +79,8 @@ '