Hi,
I'm playing with Python and Google App Engine for the first time but am unable to define a string within my function (mytest2), I get an indentation error on the line after the declaration. I can define one in the parameters that works (test) but can't see why I wouldn't be able to do it in the function aswell.
I've read a few tutorials without gaining enlightenment. Can anyone let me know what I've got wrong here?
I'm also wondering how I could do this by having something like mytest1 defined in the class and then accessible within the function?
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
class MainPage(webapp.RequestHandler):
#mytest1 = "test1"
#Runtime failure on this line talking about an indent issue
def get(self, test = 'testing!'):
mytest2= "test2" #Runtime failure on this line talking about an indent issue
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello, webapp World!\n')
self.response.out.write(self)
#self.response.out.write('\n' + mytest1)
self.response.out.write('\n' + mytest2)
application = webapp.WSGIApplication(
[('/', MainPage)],
debug=True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()