Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8507581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:54:45+00:00 2026-06-11T02:54:45+00:00

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:

  • 0
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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:54:47+00:00Added an answer on June 11, 2026 at 2:54 am

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

def process_event(request, eventID, eventData): return HttpResponse(process event!) @csrf_exempt @slip_protect def catch_event(request,eventID): if request.POST: process_event(request,eventID,
i've write a middware like this: class LogMiddleware( object ): def process_request( self, request
I have the following middleware class: class CommonContextMiddleware: def process_template_response(self, request, response): # Get
In the django.contrib.auth middleware I see the code: class AuthenticationMiddleware(object): def process_request(self, request): assert
class Middleware: def process_request(self, request): #ipreq(self) ip = request.META['HTTP_X_FORWARDED_FOR'] make_entry(ip) def make_entry(self, ip): p
This is my middleware: class Go(): def process_view(self, request, view_func, view_args, view_kwargs): aaa =
Let's say I have a view: def pony_view(request, arg1, arg2): ... Make ponies, etc
I managed to compile my .proto files like this: def build(bld): bld(rule='protoc --cpp_out=. -I..
When using python-daemon , I'm creating subprocesses likeso: import multiprocessing class Worker(multiprocessing.Process): def __init__(self,
The following is a manual process case class A(x: Int) { def f(y: Int)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.