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)
def rtotal_Index(*args, **kw): Post.refresh_total(func=INDEXPOSTFILTER)
def rtotal_AdminPost(*arg, **kw): Post.refresh_total(func=ADMINPOSTFILTER)