Last active
December 17, 2015 18:39
-
-
Save tnuki10/5654527 to your computer and use it in GitHub Desktop.
webapp2でThe URL templateを使ってみるサンプル。
動かしていないので、これで動くかどうかは分かりませんが、こんな感じで使えそう。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class aaaa(webapp2.handler): | |
def get(self, path1, path2=None, path3=None) | |
if path2 is None: | |
path2='defult' | |
if path3 is None: | |
path3='defult' | |
app = webapp2.WSGIApplication([ | |
webapp2.Route(r'/<path1>/<path2>/<path3>', handler=aaaa), | |
webapp2.Route(r'/<path1>/<path2>', handler=aaaa), | |
webapp2.Route(r'/<path1>', handler=aaaa), | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
動きました!Route.match( )の戻り値 kwargs に入ってきてくれるので、
dispatcher で捕捉できそうです。