It’s said that GAE SDK 1.5.4 has removed the requirement that blobstoreuploadhandler must return a redirect and on production it’s supposedly already so that the handler can make a “regular” response to a template with template variables. I need this capability with dev_appserver and therefore ask how I can modify the dev_appserver to admit the handler to render a template with template variables. I suppose that code I need to change is in the file
http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/tools/dev_appserver_blobstore.py
but I’m not sure what to modify. Can you tell me how to make the handler capable of a regular response?
def EndRedirect(self, redirected_outfile, original_outfile):
"""Handle the end of upload complete notification.
Makes sure the application upload handler returned an appropriate status
code.
"""
response = dev_appserver.RewriteResponse(redirected_outfile)
logging.info('Upload handler returned %d', response.status_code)
if (response.status_code in (301, 302, 303) and
(not response.body or len(response.body.read()) == 0)):
contentless_outfile = cStringIO.StringIO()
contentless_outfile.write('Status: %s\n' % response.status_code)
contentless_outfile.write(''.join(response.headers.headers))
contentless_outfile.seek(0)
dev_appserver.URLDispatcher.EndRedirect(self,
contentless_outfile,
original_outfile)
else:
logging.error(
'Invalid upload handler response. Only 301, 302 and 303 '
'statuses are permitted and it may not have a content body.')
original_outfile.write('Status: 500\n\n')
Update: The solution was posted at this link https://groups.google.com/forum/#!topic/google-appengine-python/vnvhUG1-UN0
The solution was posted and I could verify that this worked: