Skip to content

Commit

Permalink
Fixed bug where regex_predicate caused KeyError.
Browse files Browse the repository at this point in the history
  • Loading branch information
natfarleydev committed Mar 5, 2017
1 parent 728402e commit d61b600
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions skybeard/predicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
logger = logging.getLogger(__name__)


def regex_predicate(pattern, lower = False ):
def regex_predicate(pattern, lower=False):
"""Returns a predicate function which returns True if pattern is matched.
if lower == True, the text will be made lower case."""
def retfunc(chat_handler, msg):
if lower:
text = msg['text'].lower()
else:
text = msg['text']
try:
if lower:
text = msg['text'].lower()
else:
text = msg['text']
logger.debug("Matching regex: '{}' in '{}'".format(
pattern, text))
retmatch = re.match(pattern, text)
Expand Down

0 comments on commit d61b600

Please sign in to comment.