本文整理汇总了Python中models.Form.extract_keyword方法的典型用法代码示例。如果您正苦于以下问题:Python Form.extract_keyword方法的具体用法?Python Form.extract_keyword怎么用?Python Form.extract_keyword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Form
的用法示例。
在下文中一共展示了Form.extract_keyword方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle
# 需要导入模块: from models import Form [as 别名]
# 或者: from models.Form import extract_keyword [as 别名]
def handle(self, sms):
"""Método chamado pelo RapidSMS para processar uma mensagem"""
sub_type = Submission.TYPE_SMS # estamos organizando as outras branchs do projeto
answer = Config.get("message_unknown_format")
if Submission.has_confirmation_pending(sms.connection.identity):
submission = Submission.get_unconfirmed(sms.connection.identity)
answer = submission.confirm(sms.text)
return self.send_answer(sms, answer)
if Form.main_form_exists():
form = Form.get_main_form()
else:
keyword, separator, remaining_message = Form.extract_keyword(sms.text)
sms.text = remaining_message
form = Form.get_by_keyword_and_separator(keyword, separator)
if form:
answer = form.process_submission(sms, sub_type) or answer
return self.send_answer(sms, answer)