def process_health_case(request):
about = request.POST['about']
details = request.POST['narrative_text']
image=request.FILES['image_scan']
connection = Connection('mongodb://sbose78:PASSWORD@staff.mongohq.com:10068/BOSE')
if images:
db=connection['BOSE']
fs=gridfs.GridFS(db)
fs.put(image,filename="image_scan2")
else:
#nothing
return render_to_response('home/new_narrative.html',{ }, context_instance=RequestContext(request))
我得到了
expected an indented block (views.py, line 41)
第 41 行是最后一行。
我哪里错了?
谢谢。
请您参考如下方法:
您不能将评论用作空语句,您应该使用 pass 如果你想要一个什么都不做的显式 else。
if images:
db=connection['BOSE']
fs=gridfs.GridFS(db)
fs.put(image,filename="image_scan2")
else:
pass
return ....
由于没有声明,所以在 else 中发表评论在你的代码中,python 认为 return应该是else的内容并给出意图错误。
