[pypy-svn] r68508 - in pypy/build/benchmark/appengine: . templates

fijal at codespeak.net fijal at codespeak.net
Thu Oct 15 19:25:47 CEST 2009


Author: fijal
Date: Thu Oct 15 19:25:46 2009
New Revision: 68508

Added:
   pypy/build/benchmark/appengine/
   pypy/build/benchmark/appengine/app.yaml
   pypy/build/benchmark/appengine/index.yaml
   pypy/build/benchmark/appengine/main.py   (contents, props changed)
   pypy/build/benchmark/appengine/templates/
   pypy/build/benchmark/appengine/templates/all.html
   pypy/build/benchmark/appengine/templates/index.html
   pypy/build/benchmark/appengine/templates/upload.html
Log:
A version of crude appengine application


Added: pypy/build/benchmark/appengine/app.yaml
==============================================================================
--- (empty file)
+++ pypy/build/benchmark/appengine/app.yaml	Thu Oct 15 19:25:46 2009
@@ -0,0 +1,8 @@
+application: pybench
+version: 1
+runtime: python
+api_version: 1
+
+handlers:
+- url: /.*
+  script: main.py

Added: pypy/build/benchmark/appengine/index.yaml
==============================================================================
--- (empty file)
+++ pypy/build/benchmark/appengine/index.yaml	Thu Oct 15 19:25:46 2009
@@ -0,0 +1,11 @@
+indexes:
+
+# AUTOGENERATED
+
+# This index.yaml is automatically updated whenever the dev_appserver
+# detects that a new type of query is run.  If you want to manage the
+# index.yaml file manually, remove the above marker line (the line
+# saying "# AUTOGENERATED").  If you want to manage some indexes
+# manually, move them above the marker line.  The index.yaml file is
+# automatically uploaded to the admin console when you next deploy
+# your application using appcfg.py.

Added: pypy/build/benchmark/appengine/main.py
==============================================================================
--- (empty file)
+++ pypy/build/benchmark/appengine/main.py	Thu Oct 15 19:25:46 2009
@@ -0,0 +1,39 @@
+import os
+from google.appengine.ext import webapp
+from google.appengine.ext.webapp.util import run_wsgi_app
+from google.appengine.ext.webapp import template
+from google.appengine.ext import db
+
+class Result(db.Model):
+    content = db.StringProperty(multiline=True)
+    date = db.DateTimeProperty(auto_now_add=True)
+
+TEMPLATES = os.path.join(os.path.dirname(__file__), 'templates')
+
+class UploadPage(webapp.RequestHandler):
+    def post(self):
+        result = Result()
+        result.content = self.request.get('content')
+        result.put()
+        self.redirect('/')
+
+    def get(self):
+        path = os.path.join(TEMPLATES, 'upload.html')
+        self.response.out.write(template.render(path, {}))
+
+class MainPage(webapp.RequestHandler):
+    def get(self):
+        results = db.GqlQuery("select * from Result order by date desc")
+        path = os.path.join(TEMPLATES, 'all.html')
+        self.response.out.write(template.render(path, {'results': results}))
+
+application = webapp.WSGIApplication(
+    [('/upload', UploadPage),
+     ('/', MainPage)],
+    debug=True)
+
+def main():
+    run_wsgi_app(application)
+
+if __name__ == "__main__":
+    main()

Added: pypy/build/benchmark/appengine/templates/all.html
==============================================================================
--- (empty file)
+++ pypy/build/benchmark/appengine/templates/all.html	Thu Oct 15 19:25:46 2009
@@ -0,0 +1,11 @@
+<html>
+<head>
+</head>
+<body>
+<table>
+  {% for result in results %}
+  <tr><td>{{ result.date }}</td><td>{{ result.content }}</td></tr>
+  {% endfor %}
+</table>
+</body>
+</html>

Added: pypy/build/benchmark/appengine/templates/index.html
==============================================================================
--- (empty file)
+++ pypy/build/benchmark/appengine/templates/index.html	Thu Oct 15 19:25:46 2009
@@ -0,0 +1,7 @@
+<html>
+<head>
+</head>
+<body>
+Hello
+</body>
+</html>

Added: pypy/build/benchmark/appengine/templates/upload.html
==============================================================================
--- (empty file)
+++ pypy/build/benchmark/appengine/templates/upload.html	Thu Oct 15 19:25:46 2009
@@ -0,0 +1,10 @@
+<html>
+<head>
+</head>
+<body>
+<form action="upload" method="post">
+<textarea name="content" rows="3" cols="60"></textarea>
+<input type="submit" value="upload"/>
+</form>
+</body>
+</html>



More information about the Pypy-commit mailing list