Skip to content

Conversation

@janetat
Copy link
Contributor

@janetat janetat commented Jun 26, 2020

问题再现

发送消息(由post_message视图函数处理)时,出现

TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement.

原因

post_message视图函数中的expire_time返回-1或者-2,bool(-1) or bool(-2)为True。所以if not expire_time为False。所以没有处理的分支,导致此视图函数return None。

解决办法

if not expire_time -> if expire_time < 1

import datetime
import hashlib
import time
from your_code_here.RedisUtil import RedisUtil
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地方需要改成 your_code_here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants