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


Python Post.title方法代码示例

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


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

示例1: post

# 需要导入模块: from model import Post [as 别名]
# 或者: from model.Post import title [as 别名]
 def post(self):
   post = Post()
   post.title = self.request.get('title_input')
   post.content = self.request.get('content')
   post.tags_commas = self.request.get('tags')
   user = users.get_current_user()
   post.author = user
   post.catalog = self.request.get('blogcatalog')
   private = self.request.get('private')
   if private:
     post.private = True;
   else:      
     post.private = False;        
   #try:     #no need this ugly permalink now!
   #  permalink =  util.get_permalink(post.date,util.translate('zh-CN','en', util.u(post.title,'utf-8')))
   #  if not permalink:
   #    raise Exception
   #except Exception: 
   #  self.response.out.write("transalte error in title %s = %s<br />\n" % (post.title,util.get_permalink(post.date,util.translate('zh-CN','en', util.u(post.title,'utf-8')))))
   #  return
   #check the permalink duplication problem.
   #maxpermalinkBlog = db.GqlQuery("select * from Post where permalink >= :1 and permalink < :2 order by permalink desc",permalink, permalink+u"\xEF\xBF\xBD").get()
   #if maxpermalinkBlog is not None:
   #  permalink = maxpermalinkBlog.permalink+ post.date.strftime('-%Y-%m-%d')
   #post.permalink =  permalink
   post.save()    
   util.flushCategoryLists()
   util.flushArchiveLists()
   util.flushTagLists()
   util.flushPublicPosts()
   return self.redirect(post.full_permalink())    
开发者ID:BlowBlood,项目名称:blowblood,代码行数:33,代码来源:blog.py

示例2: post

# 需要导入模块: from model import Post [as 别名]
# 或者: from model.Post import title [as 别名]
 def post(self):
     my_post = Post()
     my_post.title = self.get_argument("title")
     my_post.content = self.get_argument("content")
     my_post.category_id = int(self.get_argument("category"))
     my_post.tags = self.get_model_list(
         Tag,
         **dict(in_=[("id", self.get_arguments("tags"))])
     )
     my_post.post_time = datetime.now()
     self.insert(my_post)
     self.redirect("/admin/posts")
开发者ID:daqinbuyi,项目名称:t-blog,代码行数:14,代码来源:post.py

示例3: new_post

# 需要导入模块: from model import Post [as 别名]
# 或者: from model.Post import title [as 别名]
def new_post():
    post = Post()
    post.title = request.form.get("title","untitled")
    post.author_id = session['user_id']
    post.slug = slugify(post.title)
    post.created_at = datetime.datetime.now()
    post.updated_at = datetime.datetime.now()

    db_session.add(post)
    db_session.commit()

    return redirect(url_for("edit", id=post.id))
开发者ID:bitrot,项目名称:simple-multiblog,代码行数:14,代码来源:simple.py

示例4: get_posts_on_page

# 需要导入模块: from model import Post [as 别名]
# 或者: from model.Post import title [as 别名]
def get_posts_on_page(soup,postlist):
    # find by id
    listdiv=soup.find(id="d_list")
    for child in listdiv: #this is the UL under div
        if child.name is not None:
            for grandchild in child: # this is the lis under uL
                if grandchild.name is not None:
                    post = Post()
                    time=grandchild.find_all("i")[0]
                    if time.text!=today:
                        continue
                    post.date=unicode(time.text).replace("/","-")
                    a=grandchild.find_all("a")[0]
                    post.link=a["href"]
                    post.title=unicode(a.text).replace("*","")
                    for grangrandchild in grandchild:
                        if type(grangrandchild) == NavigableString:
                            rawstr= unicode(grangrandchild).replace('-','').strip()
                            if(rawstr.strip()!=""):
                                post.author=rawstr[0:rawstr.index(" ")]
                    postlist.append(post)
    return postlist
开发者ID:dahuocang,项目名称:git_repo,代码行数:24,代码来源:pa6.py


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