Skip to content

Instantly share code, notes, and snippets.

@tokibito
Created January 9, 2011 21:50
Show Gist options
  • Save tokibito/772067 to your computer and use it in GitHub Desktop.
Save tokibito/772067 to your computer and use it in GitHub Desktop.
missing cache variable
# coding: utf-8
from google.appengine.ext.webapp import util
cachevar = None # キャッシュ用変数
def application(environ, start_response):
global cachevar
if cachevar is None:
msg = '%s'
cachevar = []
for i in range(10):
cachevar.append(i)
# 意図的に例外を発生させる
#if i == 5:
# from google.appengine.runtime import DeadlineExceededError
# raise DeadlineExceededError
else:
msg = 'hit: %s'
start_response('200 OK', [('Content-Type', 'text/plain')])
return msg % str(cachevar)
def main():
util.run_wsgi_app(application)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment