caktus / caktus/rapidsms-textpoll

Poll keyword handler _keyword method returns None instead of regex pattern

Open
#1 0 comments 0 reactions 1 assignee Claimed by @calebsmith View on GitHub
Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

If the poll keyword handler is registered as well as its subclasses, the poll handler can get picked up first when the message is routed to a handler. In the event that the base handler picks up the message, a NoneType error occurs. The bottom of that traceback is:

```
File "/home/rapidsms_raspberrypi/www/staging/env/local/lib/python2.7/site-packages/rapidsms/router/blocking.py", line 31, in receive_incoming
super(BlockingRouter, self).receive_incoming(msg)
File "/home/rapidsms_raspberrypi/www/staging/env/local/lib/python2.7/site-packages/rapidsms/router/base.py", line 199, in receive_incoming
handled = func(msg)
File "/home/rapidsms_raspberrypi/www/staging/env/local/lib/python2.7/site-packages/rapidsms/contrib/handlers/app.py", line 28, in handle
if handler.dispatch(self.router, msg):
File "/home/rapidsms_raspberrypi/www/staging/env/local/lib/python2.7/site-packages/rapidsms/contrib/handlers/handlers/keyword.py", line 55, in dispatch
match = keyword.match(msg.text)
AttributeError: 'NoneType' object has no attribute 'match'
```

Essentially, _keyword() in PollHandler returns None in the event that hasattr('keyword') is False.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.