本文整理汇总了Python中model.Article.del_post_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python Article.del_post_by_id方法的具体用法?Python Article.del_post_by_id怎么用?Python Article.del_post_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Article
的用法示例。
在下文中一共展示了Article.del_post_by_id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from model import Article [as 别名]
# 或者: from model.Article import del_post_by_id [as 别名]
def get(self, id=""):
# try:
if id:
oldobj = Article.get_article_by_id_edit(id)
print "DelPost()", oldobj
if not oldobj:
return
if MYSQL_TO_KVDB_SUPPORT:
oldobj_category = oldobj["category"]
oldobj_archive = oldobj["archive"]
oldobj_tags = oldobj["tags"]
else:
oldobj_category = oldobj.category
oldobj_archive = oldobj.archive
oldobj_tags = oldobj.tags
Category.remove_postid_from_cat(oldobj_category, str(id))
Archive.remove_postid_from_archive(oldobj_archive, str(id))
Tag.remove_postid_from_tags(set(oldobj_tags.split(",")), str(id))
Article.del_post_by_id(id)
increment("Totalblog", NUM_SHARDS, -1)
cache_key_list = ["/", "post:%s" % id, "cat:%s" % quoted_string(oldobj_category)]
clear_cache_by_pathlist(cache_key_list)
clear_cache_by_pathlist(["post:%s" % id])
self.redirect("%s/admin/edit_post/" % (BASE_URL))
示例2: get
# 需要导入模块: from model import Article [as 别名]
# 或者: from model.Article import del_post_by_id [as 别名]
def get(self, id = ''):
try:
if id:
oldobj = Article.get_article_by_id_edit(id)
Category.remove_postid_from_cat(oldobj.category, str(id))
Archive.remove_postid_from_archive(oldobj.archive, str(id))
Tag.remove_postid_from_tags( set(oldobj.tags.split(',')) , str(id))
Article.del_post_by_id(id)
increment('Totalblog',NUM_SHARDS,-1)
cache_key_list = ['/', 'post:%s'% id, 'cat:%s' % quoted_string(oldobj.category)]
clear_cache_by_pathlist(cache_key_list)
clear_cache_by_pathlist(['post:%s'%id])
self.redirect('%s/admin/edit_post/'% (BASE_URL))
except:
pass
示例3: get
# 需要导入模块: from model import Article [as 别名]
# 或者: from model.Article import del_post_by_id [as 别名]
def get(self, id = ''):
Article.del_post_by_id(id)
clear_cache_by_pathlist(['post:%s'%id])
self.redirect('%s/admin/edit_post/'% (BASE_URL))
示例4: get
# 需要导入模块: from model import Article [as 别名]
# 或者: from model.Article import del_post_by_id [as 别名]
def get(self, id=""):
Article.del_post_by_id(id)
clear_cache_by_pathlist(["post:%s" % id])
self.redirect("%s/admin/edit_post/" % (BASE_URL))