[Zope] Generating non-existent documents on the fly?
Doug Hellmann
hellmann@GNNcast.net
Wed, 20 Oct 1999 19:27:01 +0000
Stefan Hoffmeister wrote:
>
> Is there a way to generate non-existent documents on the fly - some kind
> of "rewriting" the target URL?
>
> Example site structure
>
> /root (http://localhost/)
> /content
> layout_template
> some_txt
>
> A user queries
>
> http://localhost/content/some.html
>
> Obviously, "some.html" does not exist. This is where some mechanism (the
> one I am trying to find <g>) kicks in. It will analyze the query string,
> detect that there is "some_txt" and "layout_template". Based on that it
> will generate "some.html" on the fly.
>
> Any ideas?
The obvious answer here is to rename 'layout_template' to 'some.html'.
That only gets you one dynamic page, though, and I take it from your
question that if the user tries to access
http://localhost/content/somethingelse.html and there is a
somethingelse_txt, the template should fill that in too.
If you want to write Python code, you could subclass a Folder and use
the __bobo_traverse__ method to create the object to return. I've had
good luck with this and fetching content (fully qualified HTML) out of a
database backend. It's a little messy though.
I'm not sure if you can get to the traversal code through a ZClass. I
haven't played with them much yet.
Doug
-----------------------------------------------------------------------------
Doug Hellmann Greenberg News Networks, Inc.
Software Engineer (Soon to be WebMD)
dhellmann@gnncast.net http://www.medcast.com /
http://www.webmd.com