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
}
评论列表
文章目录