예제 #1
0
 def post(self):
     response = self.request.get('message')
     query_string = self.request.get('query')
     msg = get_msg_by_key(query_string)
     email_values = {'response': response,
                     'msg': msg}
     reply = mail.EmailMessage()
     reply.sender="AE-Python Info <*****@*****.**>"
     if hasattr(msg, 'subject'):
         reply.subject="RE:" + msg.subject
     else:
         reply.subject="RE: Your info Request to AE-Python"
     reply.to = msg.sender # + msg.to TODO split string to remove self
     if msg.cc == "":
         pass
     else:
         reply.cc = msg.cc
     reply.body = template.render('templates/info-email.txt', email_values)
     reply.html = template.render('templates/info-email.html', email_values)
     reply.send()
     reply_key = store_reply(msg_key=query_string,
                             msg_sender=reply.sender,
                             msg_to=reply.to,
                             msg_cc=msg.cc,  # don't set to reply could be none
                             msg_subject=reply.subject,
                             msg_html=reply.html,
                             msg_txt=reply.body)
     set_reply_key(query_string, str(reply_key))
     self.redirect('/infoadmin')
예제 #2
0
 def post(self):
     response = self.request.get('message')
     query_string = self.request.get('query')
     msg = get_msg_by_key(query_string)
     email_values = {'response': response, 'msg': msg}
     reply = mail.EmailMessage()
     reply.sender = "AE-Python Info <*****@*****.**>"
     if hasattr(msg, 'subject'):
         reply.subject = "RE:" + msg.subject
     else:
         reply.subject = "RE: Your info Request to AE-Python"
     reply.to = msg.sender  # + msg.to TODO split string to remove self
     if msg.cc == "":
         pass
     else:
         reply.cc = msg.cc
     reply.body = template.render('templates/info-email.txt', email_values)
     reply.html = template.render('templates/info-email.html', email_values)
     reply.send()
     reply_key = store_reply(
         msg_key=query_string,
         msg_sender=reply.sender,
         msg_to=reply.to,
         msg_cc=msg.cc,  # don't set to reply could be none
         msg_subject=reply.subject,
         msg_html=reply.html,
         msg_txt=reply.body)
     set_reply_key(query_string, str(reply_key))
     self.redirect('/infoadmin')
예제 #3
0
 def get(self):
     if users.is_current_user_admin():  # secure the page only admin can access
         query_string = self.request.query_string
         message = get_msg_by_key(query_string)
         file_list = message.file_list
         attach_list = message.attachment_list
         attachments = zip(file_list, attach_list)
         values = {'logout_url': users.create_logout_url("/"),
                   'app_vars': env_vars(),
                   'message': message,
                   'attachments': attachments,
                   'qs': query_string}
         display_msg(self, values)
     else:
         self.abort(401)
예제 #4
0
 def get(self):
     if users.is_current_user_admin(
     ):  # secure the page only admin can access
         query_string = self.request.query_string
         message = get_msg_by_key(query_string)
         file_list = message.file_list
         attach_list = message.attachment_list
         attachments = zip(file_list, attach_list)
         values = {
             'logout_url': users.create_logout_url("/"),
             'app_vars': env_vars(),
             'message': message,
             'attachments': attachments,
             'qs': query_string
         }
         display_msg(self, values)
     else:
         self.abort(401)