当前位置: 首页>>代码示例>>Python>>正文


Python Post.key方法代码示例

本文整理汇总了Python中post.Post.key方法的典型用法代码示例。如果您正苦于以下问题:Python Post.key方法的具体用法?Python Post.key怎么用?Python Post.key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在post.Post的用法示例。


在下文中一共展示了Post.key方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: post

# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import key [as 别名]
	def post(self):
		if not self.user:
			self.redirect('/blog')

		subject = self.request.get('subject')
		content = self.request.get('content')
		created_by = self.user.name

		if subject and content:
			p = Post(parent = blog_key(), subject = subject, content = content, created_by = created_by)
			p.put()
			self.redirect('/blog/%s' % str(p.key().id()))
		else:
			error = "subject and content, please!"
			self.render("newpost.html", subject=subject, content=content, error=error)
开发者ID:ttu,项目名称:scratchpad,代码行数:17,代码来源:blog.py

示例2: post

# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import key [as 别名]
    def post(self):
        if not self.user:
            self.redirect('/blog')

        subject = self.request.get('subject')
        content = self.request.get('content')
        created_by = self.user.user_id
        display_name = self.user.name

        if subject and content:
            p = Post(parent = blog_key(), subject = subject, content = content, 
                     created_by = created_by, display_name = display_name)
            p.put()
            #rerun the query and update the cache
            Post.get_posts(True)

            self.redirect('/blog/%s' % str(p.key().id()))
        else:
            error = "subject and content, please!"
            self.render("newpost.html", subject=subject, content=content, error=error)
开发者ID:ttu,项目名称:appengine-blog-vs-project,代码行数:22,代码来源:blog.py

示例3: post

# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import key [as 别名]
    def post(self):
        """
            Creates new post and redirect to new post page.
        """

        if not self.user:
            return self.redirect('/blog')

        subject = self.request.get('subject')
        content = self.request.get('content')

        if subject and content:
            p = Post(parent=blog_key(), user_id=self.user.key().id(),
                     subject=subject, content=content)
            p.put()
            self.redirect('/blog/%s' % str(p.key().id()))
        else:
            error = 'Empty subject and/or content!'
            self.render('new-post.html', subject=subject,
                        content=content, error=error)
开发者ID:Ahmed-elsayed-mahmoud,项目名称:Project-3_Multi-User-Blog,代码行数:22,代码来源:blog.py

示例4: post

# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import key [as 别名]
 def post(self):
     self.response.headers.add_header("Access-Control-Allow-Origin", "http://www.jonathonduerig.com");
     postid = self.request.get("postid")
     post = self.request.get("post")
     user = self.request.get("user")
     key = self.request.get("key")
     value = self.request.get("value")
     query = Post.all()
     query.filter("postid = ", postid)
     postResult = query.fetch(1000)
     post = Post(postid=postid, post=post)
     if len(postResult) > 0:
         post = postResult[0]
     else:
         post.put()
     tag = Tag(userid=user, postkey=post.key(), tag_key=key, tag_value=value)
     tag.put()
     query = Relation.all()
     query.filter("user = ", user)
     followers = query.fetch(1000)
     for f in followers:
         tag.addToStream(f.follower)
     self.response.out.write("Tagged post " + postid + " with " + user + ":" +
                             key + "=" + value)
开发者ID:duerig,项目名称:sentagstream,代码行数:26,代码来源:tagpost.py


注:本文中的post.Post.key方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。