Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chapter_6]修复post_message的if分支逻辑 #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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

@@ -2,7 +2,7 @@
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