From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QXxjM-0002w4-D6 for garchives@archives.gentoo.org; Sat, 18 Jun 2011 15:46:40 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 97E7D1C07C; Sat, 18 Jun 2011 15:46:13 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 5B3FF1C07C for ; Sat, 18 Jun 2011 15:46:13 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id BBE431B4031 for ; Sat, 18 Jun 2011 15:46:12 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 1EB738003E for ; Sat, 18 Jun 2011 15:46:12 +0000 (UTC) From: "Petteri Räty" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Petteri Räty" Message-ID: <758c16c3424aa59c173ccad7ca2c311f1d817001.betelgeuse@gentoo> Subject: [gentoo-commits] proj/council-webapp:master commit in: bot/tests/, bot/ircmeeting/ X-VCS-Repository: proj/council-webapp X-VCS-Files: bot/ircmeeting/agenda.py bot/ircmeeting/meeting.py bot/tests/run_test.py X-VCS-Directories: bot/tests/ bot/ircmeeting/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 758c16c3424aa59c173ccad7ca2c311f1d817001 Date: Sat, 18 Jun 2011 15:46:12 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 897dd0bf1750b900f75506f53f3693d1 commit: 758c16c3424aa59c173ccad7ca2c311f1d817001 Author: Joachim Filip Ignacy Bartosik gmail com= > AuthorDate: Tue Jun 14 12:13:03 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Tue Jun 14 12:13:03 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/council-webap= p.git;a=3Dcommit;h=3D758c16c3 Disable agenda management by default Reasons: * Users may not want it, so they should be able to turn it off * Tests don't fail when localhost:3000 is unreachable * Make tests faster. --- bot/ircmeeting/agenda.py | 16 ++++++++++++++++ bot/ircmeeting/meeting.py | 1 + bot/tests/run_test.py | 1 + 3 files changed, 18 insertions(+), 0 deletions(-) diff --git a/bot/ircmeeting/agenda.py b/bot/ircmeeting/agenda.py index e3f456c..247907b 100644 --- a/bot/ircmeeting/agenda.py +++ b/bot/ircmeeting/agenda.py @@ -27,12 +27,16 @@ class Agenda(object): self.conf =3D conf =20 def get_agenda_item(self): + if not self.conf.manage_agenda: + return('') if self._current_item < len(self._agenda): return str.format(self.current_item_msg, self._agenda[self._= current_item][0]) else: return self.empty_agenda_msg =20 def next_agenda_item(self): + if not self.conf.manage_agenda: + return('') if self._vote_open: return voting_open_so_item_not_changed_msg else: @@ -41,6 +45,8 @@ class Agenda(object): return(self.get_agenda_item()) =20 def prev_agenda_item(self): + if not self.conf.manage_agenda: + return('') if self._vote_open: return voting_open_so_item_not_changed_msg else: @@ -49,6 +55,8 @@ class Agenda(object): return(self.get_agenda_item()) =20 def start_vote(self): + if not self.conf.manage_agenda: + return('') if self._vote_open: return self.voting_already_open_msg self._vote_open =3D True @@ -58,12 +66,16 @@ class Agenda(object): return str.format(self.voting_open_msg, options) =20 def end_vote(self): + if not self.conf.manage_agenda: + return('') if self._vote_open: self._vote_open =3D False return self.voting_already_closed_msg return voting_close_msg =20 def get_data(self): + if not self.conf.manage_agenda: + return('') self._voters =3D self._get_json(self.conf.voters_url) self._agenda =3D self._get_json(self.conf.agenda_url) self._votes =3D { } @@ -71,6 +83,8 @@ class Agenda(object): self._votes[i[0]] =3D { } =20 def vote(self, nick, line): + if not self.conf.manage_agenda: + return('') if not nick in self._voters: return str.format(self.can_not_vote_msg, ", ".join(self._vot= ers)) if not line.isdigit(): @@ -91,6 +105,8 @@ class Agenda(object): return result =20 def post_result(self): + if not self.conf.manage_agenda: + return('') data =3D urllib.quote(json.dumps([self._votes])) result_url =3D str.format(self.conf.result_url, self.conf.voting_results_user, diff --git a/bot/ircmeeting/meeting.py b/bot/ircmeeting/meeting.py index 108ae1d..26138a2 100644 --- a/bot/ircmeeting/meeting.py +++ b/bot/ircmeeting/meeting.py @@ -105,6 +105,7 @@ class Config(object): # Credentials for posting voting results voting_results_user =3D 'user' voting_results_password =3D 'password' + manage_agenda =3D False =20 def enc(self, text): return text.encode(self.output_codec, 'replace') diff --git a/bot/tests/run_test.py b/bot/tests/run_test.py index 79bb9d7..f4e6e49 100644 --- a/bot/tests/run_test.py +++ b/bot/tests/run_test.py @@ -344,6 +344,7 @@ class MeetBotTest(unittest.TestCase): """ =20 test =3D test_meeting.TestMeeting() + test.M.config.manage_agenda =3D True test.set_voters(['x', 'z']) test.set_agenda([['first item', ['opt1', 'opt2']], ['second item= ', []]]) test.process("""