From: Quentin Smith Date: Sun, 9 Aug 2009 22:45:33 +0000 (-0400) Subject: Show the cherrypy request object on the helloworld page X-Git-Tag: 0.1.0^2~60 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/commitdiff_plain/09b3c4465e1370966c4765ae261c910e7dd67883?ds=sidebyside Show the cherrypy request object on the helloworld page Add kwargs to helloworld for debugging purposes svn path=/package_branches/invirt-web/cherrypy-rebased/; revision=2675 --- diff --git a/code/main.py b/code/main.py index b160e63..3579794 100755 --- a/code/main.py +++ b/code/main.py @@ -68,9 +68,8 @@ class InvirtWeb(View): @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): diff --git a/code/templates/helloworld.mako b/code/templates/helloworld.mako index 22111a1..2cbb063 100644 --- a/code/templates/helloworld.mako +++ b/code/templates/helloworld.mako @@ -1,6 +1,18 @@ +<%page expression_filter="h"/> <%inherit file="skeleton.mako" /> -Hello world! +

Hello world!

+ +

kwargs:

+
+${repr(kwargs)}
+
+ +

Your request:

+ +
+${repr(dir(request))}
+
<%def name="title()"> helloworld