diff options
author | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2011-06-03 16:59:33 +0200 |
---|---|---|
committer | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2011-06-03 19:36:26 +0200 |
commit | ff432f2e42e6ece77ee9539c25ca7f109f24cfcc (patch) | |
tree | e3c5ec05ece1dd86d460473f55c8412532ae289a | |
parent | List proxies as voters (diff) | |
download | council-webapp-ff432f2e42e6ece77ee9539c25ca7f109f24cfcc.tar.gz council-webapp-ff432f2e42e6ece77ee9539c25ca7f109f24cfcc.tar.bz2 council-webapp-ff432f2e42e6ece77ee9539c25ca7f109f24cfcc.zip |
Bot posts voting results to webapp
-rw-r--r-- | bot/ircmeeting/agenda.py | 7 | ||||
-rw-r--r-- | bot/ircmeeting/meeting.py | 5 |
2 files changed, 12 insertions, 0 deletions
diff --git a/bot/ircmeeting/agenda.py b/bot/ircmeeting/agenda.py index 7ee9beb..4f0bd00 100644 --- a/bot/ircmeeting/agenda.py +++ b/bot/ircmeeting/agenda.py @@ -89,3 +89,10 @@ class Agenda(object): str = urllib.unquote(str) result = json.loads(str) return result + + def post_result(self): + data = urllib.quote(json.dumps([self._votes])) + result_url = str.format(self.conf.result_url, + self.conf.voting_results_user, + self.conf.voting_results_password) + urllib.urlopen(result_url, data = data) diff --git a/bot/ircmeeting/meeting.py b/bot/ircmeeting/meeting.py index b22dac6..a49aaaf 100644 --- a/bot/ircmeeting/meeting.py +++ b/bot/ircmeeting/meeting.py @@ -101,6 +101,10 @@ class Config(object): # Meeting management urls voters_url = 'http://localhost:3000/users/voters' agenda_url = 'http://localhost:3000/agendas/current_items' + result_url = 'http://localhost:3000/agendas/current_items' + # Credentials for posting voting results + voting_results_user = 'user' + voting_results_password = 'password' def enc(self, text): return text.encode(self.output_codec, 'replace') @@ -342,6 +346,7 @@ class MeetingCommands(object): for messageline in message.split('\n'): self.reply(messageline) self._meetingIsOver = True + self.config.agenda.post_result() def do_topic(self, nick, line, **kwargs): """Set a new topic in the channel.""" if not self.isChair(nick): return |