Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Stop two messages being sent at the end, and make answer be the whole…

… text
  • Loading branch information...
commit f87e4b97cf217e3245139b871a318117888d8a69 1 parent e18bfad
@pedantic-git pedantic-git authored
Showing with 8 additions and 8 deletions.
  1. +6 −6 src/Hunt.py
  2. +2 −2 src/SMS.py
View
12 src/Hunt.py
@@ -118,7 +118,8 @@ def guess(self, answer):
s = Success(hunt=self.hunt, team=self, clue=c)
s.put()
self._remove_clue()
- self.send_clue("Awesome! Next: ")
+ if self.clue_keys:
+ self.send_clue("Awesome! Next: ")
return True
else:
SMS.send(self.phone, "Sorry; that's wrong!")
@@ -147,7 +148,8 @@ def pass_clue(self):
"""Quit the current clue permanently in order not to get
stuck. No Success object is added."""
self._remove_clue()
- self.send_clue("Aww too bad! Next: ")
+ if self.clue_keys:
+ self.send_clue("Aww too bad! Next: ")
return True
def send_clue(self, note=''):
@@ -161,13 +163,11 @@ def send_clue(self, note=''):
return True if result == 200 else False
def read_message(self, msg):
- """Process an incoming text for this team. 'pass' or 'a <answer>'"""
+ """Process an incoming text for this team. 'pass' or '<answer>'"""
if re.search('^\s*pass\s*$', msg, re.I):
return self.pass_clue()
- m = re.search('^\s*a\s*(.*?)\s*$', msg, re.I)
- if m:
- return self.guess(m.group(1))
+ return self.guess(msg)
# What's this?
SMS.send(self.phone, "I don't understand '%s'." % msg)
View
4 src/SMS.py
@@ -26,9 +26,9 @@ class AnswerHandler(webapp.RequestHandler):
def post(self):
body = self.request.body
- m = re.search('<MessageText>(.*?)</MessageText>')
+ m = re.search('<MessageText>(.*?)</MessageText>', body)
msg = m.group(1)
- m = re.search('<From>44(\d+)</From>')
+ m = re.search('<From>44(\d+)</From>', body)
number_without_zero = m.group(1)
if msg and number_without_zero:
Please sign in to comment.
Something went wrong with that request. Please try again.