Mercurial > libervia-backend
comparison src/plugins/plugin_misc_quiz.py @ 916:1a759096ccbd
core: use of Const for profile_key + replaced '@DEFAULT@' default profile_key by '@NONE@'
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 21 Mar 2014 16:27:09 +0100 |
parents | 1fe00f0c9a91 |
children | 301b342c697a |
comparison
equal
deleted
inserted
replaced
915:6f96ee4d8cc0 | 916:1a759096ccbd |
---|---|
16 | 16 |
17 # You should have received a copy of the GNU Affero General Public License | 17 # You should have received a copy of the GNU Affero General Public License |
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 |
20 from sat.core.i18n import _ | 20 from sat.core.i18n import _ |
21 from sat.core.constants import Const as C | |
21 from logging import debug, info, warning, error | 22 from logging import debug, info, warning, error |
22 from twisted.words.xish import domish | 23 from twisted.words.xish import domish |
23 from twisted.internet import protocol, defer, threads, reactor | 24 from twisted.internet import protocol, defer, threads, reactor |
24 from twisted.words.protocols.jabber import client, jid, xmlstream | 25 from twisted.words.protocols.jabber import client, jid, xmlstream |
25 from twisted.words.protocols.jabber import error as jab_error | 26 from twisted.words.protocols.jabber import error as jab_error |
173 to_jid = jid.JID(room_jid.userhost() + "/" + next_player) | 174 to_jid = jid.JID(room_jid.userhost() + "/" + next_player) |
174 mess = self.createGameElt(to_jid) | 175 mess = self.createGameElt(to_jid) |
175 yourturn_elt = mess.firstChildElement().addElement('your_turn') | 176 yourturn_elt = mess.firstChildElement().addElement('your_turn') |
176 self.host.profiles[profile].xmlstream.send(mess) | 177 self.host.profiles[profile].xmlstream.send(mess) |
177 | 178 |
178 def playerAnswer(self, player, referee, answer, profile_key='@DEFAULT@'): | 179 def playerAnswer(self, player, referee, answer, profile_key=C.PROF_KEY_NONE): |
179 """Called when a player give an answer""" | 180 """Called when a player give an answer""" |
180 profile = self.host.memory.getProfileName(profile_key) | 181 profile = self.host.memory.getProfileName(profile_key) |
181 if not profile: | 182 if not profile: |
182 error(_("profile %s is unknown") % profile_key) | 183 error(_("profile %s is unknown") % profile_key) |
183 return | 184 return |