本文整理汇总了Python中model.Post.id方法的典型用法代码示例。如果您正苦于以下问题:Python Post.id方法的具体用法?Python Post.id怎么用?Python Post.id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Post
的用法示例。
在下文中一共展示了Post.id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from model import Post [as 别名]
# 或者: from model.Post import id [as 别名]
def post(self):
pdict = self.request.POST
try:
#def new(cls, title, category_keyname, author_keyname, url, keyword, tags, content, status=PostStatus.NORMAL, format=PostFormat.PLAIN, enablecomment=True):
tags = pdict.get("post.tags").split(",")
for i in tags:
Tag.Incr(i)
pkey = Post.new(title=pdict.get("post.title"),
category_keyname=pdict.get("post.category").decode(config.CHARSET).encode("utf-8"),
author_keyname=self.session.get("curr_ukey").decode(config.CHARSET).encode("utf-8"),
url=pdict.get("post.url"),
keyword=pdict.get("post.keyword").split(","),
tags=tags,
content=pdict.get("post.content"),
format=pdict.get("post.format") )
p = Post.id(pkey.id())
p.realurl = realurl(p)
Post.put(p)
Post.refresh_total()
except Exception, ex:
context = {}
context.update(self.request.POST)
context["errors_msg"] = ex
context["page_name"] = u"添加文章"
context["page_title"] = u"添加文章"
context["all_category"] = Category.get_all()
self.render("admin_post_editor.html", context)
示例2: post
# 需要导入模块: from model import Post [as 别名]
# 或者: from model.Post import id [as 别名]
def post(self, post_id):
post_id = int(post_id)
post = Post.id(post_id)
if not post:
#TODO 404
return
pdict = self.request.POST
nickname = pdict.get("author")
email = pdict.get("email")
website = pdict.get("url")
comment = pdict.get("comment")
logging.info(website)
#def new(cls, belong, nickname, email, author=None, re=None, ip=None, website=None, hascheck=True, commenttype=CommentType.COMMENT):
try:
c = Comment.new(belong=post,
nickname=nickname,
email=email,
website=website,
content=comment,
ip=self.request.client_ip)
except Exception, ex:
logging.info(traceback.format_exc())