relational/feedback-ltworf/feedback.py

38 lines
978 B
Python

2013-12-26 16:39:36 +07:00
from google.appengine.api import users
import webapp2
import micro_webapp2
application = micro_webapp2.WSGIApplication()
@application.route('/')
def m(request, *args, **kwargs):
return ""
2013-12-26 17:16:12 +07:00
@application.route("/version/<id>")
def show_version(request, *args, **kwargs):
if kwargs["id"] == "relational":
2020-08-12 14:25:30 +07:00
return "3.0"
2013-12-26 17:16:12 +07:00
return "No version"
2013-12-26 16:39:36 +07:00
@application.route('/feedback/<id>')
def mail_sender(request, *args, **kwargs):
2013-12-26 17:16:12 +07:00
2013-12-26 16:39:36 +07:00
if request.method != "POST":
return ""
2013-12-26 17:16:12 +07:00
2013-12-26 16:39:36 +07:00
message = ""
for k,v in request.POST.iteritems():
message += "%s: %s\n" % (k,v)
2013-12-28 03:53:21 +07:00
message += "ip address: %s\n" % str(request.remote_addr)
2013-12-26 17:16:12 +07:00
2013-12-26 16:39:36 +07:00
if kwargs["id"] == "relational":
from google.appengine.api import mail
mail.send_mail(sender="Feedback service <noreply@feedback-ltworf.appspotmail.com>",
2013-12-26 16:39:36 +07:00
to="tiposchi@tiscali.it",
subject="Feedback from %s" % kwargs["id"],
body=message)
return "Message queued"