hey thanks for the great article, it was very helpful. However this
is not exactly what I'm after. the article is more referring to url
query strings. I want to make variables out of the url path. This
sort of thing is possible in the Cocoon framework, so I thought it
would be possible here as well.
Say, i have three URLs in my app:
www.myproject.com/cat
www.myproject.com/dog
www.myproject.com/fish
Using the tutorial code, I would need to do this:
application = webapp.WSGIApplication(
[('/cat', CatHandler),
('/dog', DogHandler),
(‘/fish’, FishHandler)])
As the application gets big, this list of tuples will be huge. i'd
rather use the () operator in a regular expression ot make a variable
out of that changing last part of the url, and have a single piece of
code dispatching the urls like this:
application = webapp.WSGIApplication(
[('/(Cat|Dog|Fish)', {1}Handler)
])
This regular expression should match either /Cat or /Dog or /Fish, and
should make Cat or Dog or Fish into a variable to be used.
How is this done? Thanks.
On Sep 9, 8:24 pm, vorun <[EMAIL PROTECTED]> wrote:
> take a look @http://code.google.com/appengine/articles/rpc.html
>
> On Sep 9, 6:03 pm, darren <[EMAIL PROTECTED]> wrote:
>
> > When mapping URLs to request handlers, the way I’m coding it is like
> > so:
>
> > application = webapp.WSGIApplication(
> > [('/Cat', CatHandler),
> > ('/Dog', DogHandler),
> > (‘/Fish’, FishHandler)])
>
> > Instead of hard coding each URL to a handler, is there anyway I can
> > get a variable out of the Regular expression to use? Something like
> > this:
>
> > application = webapp.WSGIApplication(
> > [('/(Cat|Dog|Fish)', {1}Handler)
> > ])
>
> > Where {1} is a variable that would be Cat or Dog or Fish, depending on
> > what the user wished.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---