[albatross-users] Simple random mode demo app
Dave Cole
djc at object-craft.com.au
Mon Jun 2 10:58:35 EST 2003
> Sorry, the 1st URL should be
> http://mattgoodall.dyndns.org/~matt/albatross/test/test.py.
Had a bit of a play and looked at some of the code.
I very much like the code that transparently handles cgi and
mod_python deployment. One change though:
if __name__ == '__main__':
# CGI entry point
from albatross.cgiapp import Request
app = App()
app.run(Request())
else:
# mod_python entry point
from albatross.apacheapp import Request
def handler(req):
app = App()
return app.run(Request(req))
The mod_python code should be changed to this:
# mod_python entry point
from albatross.apacheapp import Request
app = App()
def handler(req):
return app.run(Request(req))
If you instantiate the application once then you get the benefit of
caching of both templates and page modules.
> > * Using the tree tag to display a categorised view of what's in
> > the test app.
Nice use of style sheets to indent.
> > * Custom tags: one that inserts the current time, one that
> > displays its content in a nicely coloured box and one that
> > caches the content to disk for a period of time.
The content caching tag is a work of genius.
Maybe you could expand on the idea and implement a content cache mixin
that could be inherited by the application class. This would then
ensure that the cached content was loaded only once (for mod_python)
applications.
I would love to add a cache like that to Albatross.
- Dave
--
http://www.object-craft.com.au
More information about the Albatross-users
mailing list