本文整理汇总了Python中model.Comment.authorEmail方法的典型用法代码示例。如果您正苦于以下问题:Python Comment.authorEmail方法的具体用法?Python Comment.authorEmail怎么用?Python Comment.authorEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Comment
的用法示例。
在下文中一共展示了Comment.authorEmail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from model import Comment [as 别名]
# 或者: from model.Comment import authorEmail [as 别名]
def post(self):
verify = self.request.get('sdamwegmw')
if verify != "AfnGDASsdafSA" :
return self.error(403)
post_id_ = self.request.get('post_id')
post = Post.get_by_id(int(post_id_))
if post is None:
return self.redirect('/')
comment = Comment()
comment.post = post
comment.author = self.request.get('comm_name')
if users.is_current_user_admin():
comment.author_is_admin = True
comment.authorEmail = self.request.get('comm_email')
comment.authorWebsite = self.request.get('comm_url')
comment.content = self.request.get('comment')
comment.userIp = self.request.remote_addr
user = users.get_current_user()
if user is not None:
comment.user = user
comment.author = str(user.nickname())
comment.authorEmail = str(user.email())
cookies = Cookie.SimpleCookie()
cookies['comm_name'] = urllib.quote(comment.author.encode('utf8'))
cookies['comm_name']['path'] = '/'
cookies['comm_name']['max-age'] = 3600*24*365
cookies['comm_email'] = comment.authorEmail
cookies['comm_email']['path'] = '/'
cookies['comm_email']['max-age'] = 3600*24*365
cookies['comm_url'] = comment.authorWebsite
cookies['comm_url']['path'] = '/'
cookies['comm_url']['max-age'] = 3600*24*365
output_headers = []
output_headers.append('%s\r\n' % cookies)
for header in output_headers:
sys.stdout.write(header)
comment.save()
util.flushRecentComment()
return self.redirect(post.full_permalink())