def SetPageValues(request,pageInfo): title = pub.GetPostData(request,'title') summary=pub.GetPostData(request,'summary') content = pub.GetPostData(request,'content') status = pub.GetPostData(request,'status') cancomment = pub.GetPostData(request,'cancomment') password = pub.GetPostData(request,'password') template=pub.GetPostData(request,"template","normal") sidebar=pub.GetPostData(request,"sidebar","normal") sidebarfloat=pub.GetPostData(request,"sidebarfloat","none") if summary=="": tempContent=utility.RemoveTags(content) summary=tempContent[0:200] if len(tempContent)>200 else tempContent else: summary=utility.RemoveTags(summary) pageInfo.title = title pageInfo.summary=summary pageInfo.content = content pageInfo.createtime=datetime.datetime.now() #titlestyle={} #titlestyle.setdefault("b",True) #加粗 #titlestyle.setdefault("i",True) #斜体 #titlestyle.setdefault("u",True) #下划张 #titlestyle.setdefault("c",True) #颜色 #pageInfo.views=0 #pageInfo.comments=0 #pageInfo.goods=0 #pageInfo.bads=0 pageInfo.status=True if status=="1" else False pageInfo.cancomment=cancomment pageInfo.password=password pageInfo.user_id=1 pageInfo.username="******" pageInfo.template=template pageInfo.sidebar=sidebar pageInfo.sidebarfloat=sidebarfloat
def PostContext(self, **kwargs): uid = int(kwargs.get("uid", 0)) if self.HasPostData("ok"): self.currentBlog.domain = self.GetPostData("domain") self.currentBlog.save() myModuleArray = pub.GetPostData(request, "modules").split(",") retModules = "" for key in myModuleArray: if modules.moduleList.has_key(key): retModules += key + "," currentBlog.modules = retModules currentBlog.save() return locals()
def SetArticleValues(request, articleInfo): channel1Id = int(pub.GetPostData(request, 'channel1', 0)) channel2Id = int(pub.GetPostData(request, 'channel1', 0)) title = pub.GetPostData(request, 'title') pic = pub.GetPostData(request, 'pic') tags = pub.GetPostData(request, 'tags') summary = pub.GetPostData(request, 'summary') content = pub.GetPostData(request, 'content') status = pub.GetPostData(request, 'status') ishome = pub.GetPostData(request, 'ishome') isrecommend = pub.GetPostData(request, 'isrecommend') istop = pub.GetPostData(request, 'istop') isoriginal = pub.GetPostData(request, 'isoriginal') cancomment = pub.GetPostData(request, 'cancomment') password = pub.GetPostData(request, 'password') if summary == "": tempContent = utility.RemoveTags(content) summary = tempContent[0:200] if len(tempContent) > 200 else tempContent else: summary = utility.RemoveTags(summary) articleInfo.channel1_id = channel1Id articleInfo.channel2_id = channel2Id articleInfo.title = title articleInfo.pic = pic articleInfo.tags = tags articleInfo.summary = summary articleInfo.content = content #articleInfo.createtime=datetime.datetime.now() #articleInfo.views=0 #articleInfo.comments=0 #articleInfo.goods=0 #articleInfo.bads=0 articleInfo.status = 1 if status else 0 articleInfo.ishome = 1 if ishome else 0 articleInfo.isrecommend = 1 if isrecommend else 0 articleInfo.istop = 1 if istop else 0 articleInfo.isoriginal = 1 if isoriginal else 0 articleInfo.cancomment = 1 if cancomment else 0 articleInfo.password = password
def GetPostData(self, key, default=""): return pub.GetPostData(self.request, key, default)