[Zope] Re: catching shorter URLs
J Cameron Cooper
jccooper at rice.edu
Mon Jul 9 10:34:15 EDT 2007
Aaron Maupin wrote:
> I'm trying to make pretty URLs for a game site I'm developing, and due
> to the hosting environment I'm somewhat limited in my Apache URL
> rewrites. (I've tried the normal mod_proxy / mod_rewrite rules and they
> haven't worked in this environment.)
>
> I'd like the visitors to see
>
> http://games.mydomain.com/game-title
>
> Whereas what's really being accessed is
>
> http://www.mydomain.com/display_game?title=game-title
>
> or any solution that allows me to query a relational database for a game
> title so I don't have to create hundreds of objects in Zope.
>
> The only idea I have now is to use a Virtual Host Monster mapping to
> send visitors using the games.mydomain.com to a folder that contains a
> custom standard_error_message that reads the request object, figures out
> the game title, and queries the database.... but that's really inelegant.
>
> Is there a way to inspect the request before Zope starts traversing
> objects?
>
> Or any other ideas on how to accomplish what I want? I'm not new to
> Zope, but I basically use it as a container for Python scripts and
> haven't delved too deeply into it otherwise... so I may be missing
> something obvious.
Why not just make the display_game method get its value from the path?
That will simplify your task greatly. Here, 'traverse_subpath' is your
friend.
--jcc
--
Connexions
http://cnx.org
"Building Websites with Plone"
http://plonebook.packtpub.com
More information about the Zope
mailing list