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


Python Post.put方法代码示例

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


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

示例1: receive

# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import put [as 别名]
 def receive(self, message):
     post = Post()
     html_bodies = message.bodies('text/html')
     img_links = []
     video_links = []
     for content_type, body in html_bodies:
         decoded_body = body.decode()
         img_links.extend(self.find_image_links(decoded_body))
         video_links.extend(self.find_video_links(decoded_body))
 
     if hasattr(message, "attachments") and message.attachments:
         post.attachments = []
         for attachment in message.attachments:
             post.attachments.append(db.Blob(attachment[1].decode()))
 
     plaintext_bodies = message.bodies('text/plain')
     allBodies = '';
     for body in plaintext_bodies:
         allBodies = allBodies + body[1].decode()
 
     if hasattr(message, "subject"):
         subject, encoding = decode_header(message.subject)[0]
         post.caption = unicode(subject)
     post.author = message.sender
     post.content = allBodies
     post.images = img_links
     post.videos = video_links
     post.source = "email"
     post.put()
开发者ID:sephiria,项目名称:sandbox,代码行数:31,代码来源:handle_kitten_mail.py

示例2: post

# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import put [as 别名]
 def post(self):
     user = users.get_current_user()
     
     if user:
         post = Post(parent = Post.post_db_key(), author = user, content = self.request.get("content"))
         post.put()
     
     self.redirect('/')
开发者ID:Dudy,项目名称:nonaco-toolbox,代码行数:10,代码来源:homepage.py

示例3: post

# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import put [as 别名]
    def post(self):
        user = users.get_current_user()
        if not user or not users.is_current_user_admin():
            self.redirect(users.create_login_url(self.request.uri))
            return

        post = Post()
        post.title = self.request.POST['title']
        post.put()

        self.redirect('/admin/posts/edit/' + str(post.key.id()))
开发者ID:eholec,项目名称:jetpoweredblog,代码行数:13,代码来源:posts.py

示例4: post

# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import put [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

示例5: get_posts

# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import put [as 别名]
 def get_posts(self):
     user = users.get_current_user()
     post_list = []
     
     post_query = Post.query(ancestor = Post.post_db_key()).order(-Post.created)
     post_list = post_query.fetch(10)
     
     if user and len(post_list) == 0:
         post = Post(parent = Post.post_db_key(), author = user, content = 'Hallo Leute! Hier ist mal eine allererste Version des Kollaborationswerkzeugs, ich nenne das erst mal einfach nur <b>Toolbox</b>. In dieser ersten Version kann man allerdings noch nichts machen, ich arbeite dran ;-) Schaut euch die Seite zwei, drei mal am Tag an, ich will zügig Ergebnisse liefern.')
         post.put()
         
         post_query = Post.query(ancestor = Post.post_db_key()).order(-Post.created)
         post_list = post_query.fetch(10)
     
     return post_list
开发者ID:Dudy,项目名称:nonaco-toolbox,代码行数:17,代码来源:homepage.py

示例6: post

# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import put [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

示例7: post

# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import put [as 别名]
    def post(self):
        bot_test = self.request.get('bot_test').strip().lower()
        if (bot_test != 'orange'):
            self.redirect('/')
            return
             
        post = Post()

        if users.get_current_user():
            post.author = users.get_current_user().nickname()

        url = self.request.get('url').strip()
        if url:
            if not url.startswith("http"):
                url = "http://"+url
        post.images = [db.Link(url)]
        post.caption = self.request.get('caption')
        post.source = "homepage"
        post.put()
        self.redirect('/')
开发者ID:sephiria,项目名称:sandbox,代码行数:22,代码来源:main.py

示例8: post

# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import put [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

示例9: post

# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import put [as 别名]
    def post(self):
        # If any user does not logged in redirect to homepage
        if not self.user:
            self.redirect('/')

        values = {
            'subject': self.request.get('subject').strip(),
            'content': self.request.get('content').strip()}

        if values['subject'] and values['content']:
            post = Post(
                subject=values['subject'],
                content=values['content'],
                user=self.user)
            post.put()
            self.redirect(post.link_to('show'))
        else:
            errors = {}
            if not values['subject']:
                errors['subject'] = "can't be blank"
            if not values['content']:
                errors['content'] = "can't be blank"
            self.render("/posts/new.html", values=values, errors=errors)
开发者ID:sbagdat,项目名称:multiplog,代码行数:25,代码来源:main.py

示例10: post

# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import put [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.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。