Vincent Jones wrote:
SyntaxError at /

("'return' outside function",
('c:\\Users\\Vincent\\Documents\\django_bookmarks\\..\\django_bookmarks\\boo
kmarks\\views.py', 15, None, 'return HttpResponse(output)\n'))

<snip> from django.http import HttpResponse

def main_page(request) :

   output = '''

  <html>

     <head><title>%s</title></head>

     <body>

        <h1>%s</h1><p>%s</p>

     </body>

  </html>

''' % (

      'Django Bookmarks',

      'Welcome to Django Bookmarks',

      'Where you can store and share bookmarks!'

)

return HttpResponse(output)

<snip>
The return line needs to be indented the same as the other line(s) in the function definition, which is to say it has to line up with the output= line.

There really are only two lines in the body of the function, and they need to start at the same column.

(It'd be easier on all of us if the code in your message weren't doublespaced, as well. That might be a email setting. Try using plain text, and see if it works better.)

DaveA

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to