Permalink
Browse files

- Add templates directory

- test.py fixes: rename /tp to /asyncpagetest, add -prof flag to enable/disable profiler



git-svn-id: http://chiral.j4cbo.com/svn/trunk@82 a827fe29-2235-0410-a7a9-cacdfe24a5d3
  • Loading branch information...
jacob
jacob committed Dec 25, 2007
1 parent 7f28760 commit 5fb02e713e33f6df1fad4c6a45720df33ed95dbf
Showing with 22 additions and 8 deletions.
  1. 0 chiral/web/templates/__init__.py
  2. +8 −0 chiral/web/templates/helloworld.html
  3. +14 −8 test.py
No changes.
@@ -0,0 +1,8 @@
<html>
<head>
<title>${foo}</title>
</head>
<body>
<h1>${foo}</h1>
</body>
</html>
View
22 test.py
@@ -2,13 +2,16 @@
print "Loading modules..."
import sys
from chiral.core import stats
from chiral.net import reactor
from chiral.web.httpd import HTTPServer
from chiral.shell import ChiralShellServer
from paste.urlmap import URLMap
from paste.httpexceptions import HTTPNotFound
from chiral.core.threadpool import run_in_thread
print "Loading applications..."
@@ -21,17 +24,19 @@
print "Initializing..."
@coroutine_page()
@use_template("genshi", "chiral.web.templates.asdf")
@use_template("genshi", "chiral.web.templates.helloworld")
def asyncpagetest():
yield reactor.schedule(delay = 1)
yield
raise StopIteration({ "foo": "Test Page" })
introspector = Introspector()
application = URLMap()
application.update({
"/pony": PonyMiddleware(HTTPNotFound()),
"/introspector": Introspector(),
"/static": StaticFileServer("/home/jacob/code/chiral/static"),
"/tp": asyncpagetest,
"/asyncpagetest": asyncpagetest,
"/cometlib": CometLibServer(),
"/": CometClock()
})
@@ -47,11 +52,12 @@ def asyncpagetest():
print "Running..."
import cProfile
def run():
if "-prof" in sys.argv:
import cProfile
def run():
reactor.run()
cProfile.run(run.func_code, "test.prof")
else:
reactor.run()
cProfile.run(run.func_code, "test.prof")
stats.dump()

0 comments on commit 5fb02e7

Please sign in to comment.