From e52271aff9f4efe9f0eee9ee4fa218f38776aeb4 Mon Sep 17 00:00:00 2001 From: Trevor Johns Date: Fri, 27 Jan 2012 20:02:18 -0800 Subject: [PATCH] Generate a valid main.py for use with developer.android.com. This fixes bugs in divide_and_compress_constants.py that caused a corrupt main.py file to be generated for developer.android.com. Specifically, extra quotes are no longer added, __main__ is now in quotes, and webapp.WSGIApplication() parameters are now correct. Also moved the call to memcache_zipserve.create_handler() to a seperate line for readability. Change-Id: I8906c54e70b2889389a95b92d4fbcf05a6c3e22d --- scripts/divide_and_compress_constants.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/scripts/divide_and_compress_constants.py b/scripts/divide_and_compress_constants.py index 15162b712..89a607d2b 100644 --- a/scripts/divide_and_compress_constants.py +++ b/scripts/divide_and_compress_constants.py @@ -36,23 +36,24 @@ file_preamble = """#!/usr/bin/env python # limitations under the License. # -import wsgiref.handlers\n' -from google.appengine.ext import zipserve\n' -from google.appengine.ext import webapp\n' -import memcache_zipserve\n\n\n' +import wsgiref.handlers +from google.appengine.ext import zipserve +from google.appengine.ext import webapp +import memcache_zipserve + class MainHandler(webapp.RequestHandler): def get(self): self.response.out.write('Hello world!') def main(): - application = webapp.WSGIApplication(['/(.*)', - memcache_zipserve.create_handler([""" + handler = memcache_zipserve.create_handler([""" -file_endpiece = """])), -], -debug=False) +file_endpiece = """ + ]) + application = webapp.WSGIApplication([('/(.*)', handler)], debug=False) wsgiref.handlers.CGIHandler().run(application) -if __name__ == __main__: - main()""" +if __name__ == '__main__': + main() +""" \ No newline at end of file