Re: add query string to redirect.internal?
"Jonathan Ellis" <[email protected]> Tue, 27 Mar 2007 14:51:39 -0700
| Newsgroups | gmane.comp.python.spyce.general |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 27 Mar 2007 15:46:44 -0400, "Philip Semanchuk" <[email protected]> said: > Hi all, > I'd like to use Spyce's redirect.internal to do some URL rewriting. I'd > like to take a URL like this: > http://example.com/rabbit.spy > and redirect that to: > http://example.com/grenade.spy?type=holy > > I can redirect to grenade.spy with no problem by populating rabbit.spy > with this: > [[.import name=redirect]] > [[redirect.internal('/grenade.spy')]] > > But if I try to include a query string on the target URI, I get a 404 > because Spyce treats the query string as part of the target filename. > In other words, even though the URL > "http://example.com/grenade.spy?type=holy" works when typed directly > into the browser, trying to redirect.internal to it gives me "404: > grenade.spy?type=holy not found" -- > [[redirect.internal('/grenade.spy?type=holy')]] > > I guess this is because Spyce already has a request object constructed > and that request object has a blank query string. Is it possible to > modify the request object before the redirect? > > I tried to search the sourceforge archive but ATM trying to look at any > messages returns a 500 Internal server error. :-/ Hmm, yeah, this has been a limitation forever. Thinking about it though all, the other frameworks I can think of don't create a new request either when you say "run this other script instead." So I'd be inclined to call it a "feature." :) IMO the "right" way to do this feature is as something handled by spyceWWW. (As an added bonus, it wouldn't need to delve into the Spyce guts much.) A regexp-based system like django's would be pretty easy to add. The port of Routes to Python done by the Pylon guys might also be feasible (and IMO is a friendlier interface to use), although its assumption of a controller-based architecture would probably require some coding to work around. -Jonathan ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV