html/javascript テンプレートの文字列置換を試みていますが、ページ文字列変数のコードに中括弧が含まれていると、「ValueError: サポートされていない書式文字 '}' (0x7d)」というエラーが発生します。文字列の置換がない場合、すべて正常に動作します。読んでくれてありがとう!
import webapp2
page = """
<html>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
%(say)s
</html>
"""
class MainHandler(webapp2.RequestHandler):
def write_form(self, say):
self.response.out.write(page % { "say": say })
def get(self):
self.write_form("hello")
app = webapp2.WSGIApplication([('/', MainHandler)],
debug=True)