public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Petteri Räty" <betelgeuse@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/council-webapp:master commit in: bot/tests/, bot/ircmeeting/
Date: Sat, 18 Jun 2011 15:46:12 +0000 (UTC)	[thread overview]
Message-ID: <758c16c3424aa59c173ccad7ca2c311f1d817001.betelgeuse@gentoo> (raw)

commit:     758c16c3424aa59c173ccad7ca2c311f1d817001
Author:     Joachim Filip Ignacy Bartosik <jbartosik <AT> gmail <DOT> com>
AuthorDate: Tue Jun 14 12:13:03 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Tue Jun 14 12:13:03 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/council-webapp.git;a=commit;h=758c16c3

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 = conf
 
     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
 
     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())
 
     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())
 
     def start_vote(self):
+        if not self.conf.manage_agenda:
+          return('')
         if self._vote_open:
             return self.voting_already_open_msg
         self._vote_open = True
@@ -58,12 +66,16 @@ class Agenda(object):
         return str.format(self.voting_open_msg, options)
 
     def end_vote(self):
+        if not self.conf.manage_agenda:
+          return('')
         if self._vote_open:
             self._vote_open = False
             return self.voting_already_closed_msg
         return voting_close_msg
 
     def get_data(self):
+        if not self.conf.manage_agenda:
+          return('')
         self._voters = self._get_json(self.conf.voters_url)
         self._agenda = self._get_json(self.conf.agenda_url)
         self._votes = { }
@@ -71,6 +83,8 @@ class Agenda(object):
             self._votes[i[0]] = { }
 
     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._voters))
         if not line.isdigit():
@@ -91,6 +105,8 @@ class Agenda(object):
         return result
 
     def post_result(self):
+        if not self.conf.manage_agenda:
+          return('')
         data = urllib.quote(json.dumps([self._votes]))
         result_url = 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 = 'user'
     voting_results_password = 'password'
+    manage_agenda = False
 
     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):
         """
 
         test = test_meeting.TestMeeting()
+        test.M.config.manage_agenda = True
         test.set_voters(['x', 'z'])
         test.set_agenda([['first item', ['opt1', 'opt2']], ['second item', []]])
         test.process("""



             reply	other threads:[~2011-06-18 15:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-18 15:46 Petteri Räty [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-07-18  7:41 [gentoo-commits] proj/council-webapp:master commit in: bot/tests/, bot/ircmeeting/ Petteri Räty
2011-06-25 11:55 Petteri Räty
2011-06-25 11:55 Petteri Räty
2011-06-22  7:59 Petteri Räty
2011-06-22  7:59 Petteri Räty
2011-06-18 15:46 Petteri Räty
2011-06-18 15:46 Petteri Räty
2011-06-18 15:46 Petteri Räty
2011-06-18 15:46 Petteri Räty
2011-06-18 15:46 Petteri Räty
2011-06-05 20:37 Petteri Räty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=758c16c3424aa59c173ccad7ca2c311f1d817001.betelgeuse@gentoo \
    --to=betelgeuse@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox