Reputation: 1811
def process_health_case(request):
about = request.POST['about']
details = request.POST['narrative_text']
image=request.FILES['image_scan']
connection = Connection('mongodb://sbose78:[email protected]: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.
Upvotes: 1
Views: 1398
Reputation: 180887
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.
Upvotes: 6