This is why I never use webapp and all the other RE based route methods.
I have used bobo (which just maps urls to objects)
http://bobo.digicool.com/
T
On Saturday, July 28, 2012 1:53:03 PM UTC+8, soujiro0725 wrote:
>
> GAE for Python 1.7.0
>
>
> We normally set up the routing like,
>
> PAGE_RE = r'(/(?:[a-zA-Z0-9_-]+/?)*)'
>>
> app = webapp2.WSGIApplication([('/?', MainPage),
>> ('/signup', Register),
>> ('/login', Login),
>> ('/logout', Logout),
>> ('/_upload', Upload),
>> ('/_accept', AcceptPost),
>> ('/?' + JSON_LIST_RE, JsonListHandler),
>> ('/(.*).json', JsonHandler),
>> ('/_edit' + PAGE_RE, EditPageHandler),
>> ('/_history' + PAGE_RE, HistoryHandler),
>> ('/?' + PAGE_RE, WordPageHandler),
>> ('/?' + LIST_RE, WordListPageHandler),
>> ('/(.*)', WordPageHandler)
>> ],
>> debug=True)
>
>
> An appropriate handler is to be chosen in accordance with the regular
> expression and the order of the handlers.
> But it is getting messy. I need to clean things up.
>
> So hopefully I would like to pass it through conditional statements.
>
> class Conditional(Handler):
>> def get(self, newpost):
>> if "+" in newpost:
>> self.response.write('choice 1')
>> else:
>> self.response.write('choice 2')
>
>
> My question is How can I apply a handler IN the handler?
>
> in the above Conditional(Handler): case, I tried to put
> 'WordPageHandler'. Certainly it does not seem to work
>
> class Conditional(Handler):
>> def get(self, newpost):
>> if "+" in newpost:
>> WordPageHandler
>
>
>
> Is is possible to set up nested handlers?
>
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-appengine/-/0jT8hHNIGekJ.
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.