Show the cherrypy request object on the helloworld page
authorQuentin Smith <quentin@mit.edu>
Sun, 9 Aug 2009 22:45:33 +0000 (18:45 -0400)
committerQuentin Smith <quentin@mit.edu>
Sun, 9 Aug 2009 22:45:33 +0000 (18:45 -0400)
Add kwargs to helloworld for debugging purposes

svn path=/package_branches/invirt-web/cherrypy-rebased/; revision=2675

code/main.py
code/templates/helloworld.mako

index b160e63..3579794 100755 (executable)
@@ -68,9 +68,8 @@ class InvirtWeb(View):
 
     @cherrypy.expose
     @cherrypy.tools.mako(filename="/helloworld.mako")
 
     @cherrypy.expose
     @cherrypy.tools.mako(filename="/helloworld.mako")
-    def helloworld(self):
-        return {}
-        return "Hello world!\nYour request: "+repr(dir(cherrypy.request))
+    def helloworld(self, **kwargs):
+        return {'request': cherrypy.request, 'kwargs': kwargs}
     helloworld._cp_config['tools.require_login.on'] = False
 
 def pathSplit(path):
     helloworld._cp_config['tools.require_login.on'] = False
 
 def pathSplit(path):
index 22111a1..2cbb063 100644 (file)
@@ -1,6 +1,18 @@
+<%page expression_filter="h"/>
 <%inherit file="skeleton.mako" />
 
 <%inherit file="skeleton.mako" />
 
-Hello world!
+<p>Hello world!</p>
+
+<p>kwargs:</p>
+<pre style="white-space: pre-wrap">
+${repr(kwargs)}
+</pre>
+
+<p>Your request:</p>
+
+<pre style="white-space: pre-wrap">
+${repr(dir(request))}
+</pre>
 
 <%def name="title()">
 helloworld
 
 <%def name="title()">
 helloworld