accounts.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:Tktr 作者: Intuity 项目源码 文件源码
def user_profile_view(self):
        if not self.request.matchdict["user_id"] in self.request.root.users:
            self.request.session.flash("Requested user does not exist!", "error")
            return HTTPFound(location=self.request.route_path("admin_accounts"))
        user = self.request.root.users[self.request.matchdict["user_id"]]
        if "action" in self.request.GET:
            if self.request.GET["action"] == "counttotal":
                user.total_tickets = len(user.tickets)
                self.request.session.flash("Recounted the total number of tickets this user has.", "info")
            elif self.request.GET["action"] == "sendtickets":
                emailer = GenericEmail(self.request)
                emailer.compose_and_send(
                    "Event Tickets",
                    """Please find the tickets you have purchased attached as a PDF to this email. Please download and print-out the tickets and bring them with you to the event.""",
                    user.__name__,
                    pdf_attachment=TicketDownload(self.request).user_tickets_pdf(user)
                )
                self.request.session.flash("All tickets have been sent to this user via email.", "info")
        if user.profile == None:
            self.request.session.flash("Requested user had not setup a profile, now has a blank profile.", "info")
            user.profile = UserProfile()
            user.profile.__parent__ = user
        return {
            "chosen_user": user
        }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号