-
Notifications
You must be signed in to change notification settings - Fork 2
/
comment.py
45 lines (33 loc) · 1.13 KB
/
comment.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import webapp2
import comment_func
from google.appengine.api import users
import session
import os
# import module for templates
import jinja2
# for logging message to server log
import logging
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
class AddComment(webapp2.RequestHandler):
def post(self):
if session.checkTokenValid(self) is False:
return
eventid = self.request.get('eventid')
comment = self.request.get('comment')
logging.info('Received AddComment for ' + eventid + ' : ' + comment)
comment_func.addComment(eventid, comment)
class GetList(webapp2.RequestHandler):
def post(self):
eventid = self.request.get('eventid')
startcomment = self.request.get('startcomment')
commentno = self.request.get('commentno')
logging.info('Received GetList for ' + eventid + ', startcomment' +
startcomment +', no: ' + commentno)
commentlist = comment_func.getCommentList()
app = webapp2.WSGIApplication([
('/comments/add', AddComment),
('/comments/getlist', GetList)
], debug=True)