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))
I'm getting
expected an indented block (views.py, line 41)
And line 41 is the last line.
Where am I wrong?
Thanks.
You can't use a comment as an empty statement, you should use pass
if you want to have an explicit else that does nothing.
if images:
db=connection['BOSE']
fs=gridfs.GridFS(db)
fs.put(image,filename="image_scan2")
else:
pass
return ....
Since there's no statement, just a comment in the else
in your code, python thinks the return
is supposed to be the content of the else
and gives an intentation error.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.