开发者

Is it possible to retrieve an uri chunk on AppEngine?

开发者 https://www.devze.com 2022-12-27 18:48 出处:网络
Let\'s sayi go to myblog.com/post/12. The /post handler is开发者_JAVA百科 already defined, but how can i get the parameter being passed? 12in this case is the post_id.

Let's say i go to myblog.com/post/12. The /post handler is开发者_JAVA百科 already defined, but how can i get the parameter being passed? 12 in this case is the post_id.

I'm using the Python SDK.


Sure.

Example rule:

('/post/(\d+)', views.PostHandler)

Example view:

class PostHandler(BaseHandler):
    ''' Handler for viewing blog posts. '''
    def get(self, id):
        blog_post = models.BlogPost.get_by_id(int(id))
0

精彩评论

暂无评论...
验证码 换一张
取 消