Esempio n. 1
0
 def post(self, rater, rating, comment_text):
     if comment_text:
         comment_text = urllib2.unquote(comment_text)
         if type(comment_text) == type(""):
             comment_text = comment_text.decode("latin1")
     else:
         comment_text = ""
     rater_rating = RaterRating.update(rater, int(rating), comment_text)
     if rater_rating is not None:
         if comment_text != "":
             Comment.create(comment_text, int(rating), rater_rating.tags)
         self.response.out.write(
             simplejson.dumps({
                 'rater_id':
                 rater_rating.rater_id,
                 'result':
                 True,
                 'pusher_message':
                 make_push_rating_message(rater_rating, comment_text)
             }))
     else:
         self.error(404)
         self.response.out.write(
             simplejson.dumps({
                 'rater_id': None,
                 'result': False
             }))
Esempio n. 2
0
 def post(self):
     user = util.get_user_from_session()
     message = self.request.get('message')
     owner_email = self.request.get('owner_email')
     bout_id = self.request.get('bout_id')
     bout = Bout.get_by_id(long(bout_id))
     photo = Photo.for_bout_user(bout, owner_email)
     Comment.create(user, photo, message)
     Notification.create('comment_add', photo.bout.owner, user.email, bout)
Esempio n. 3
0
 def do_action(self):
     args = self.get_args([
         ('text_id', str, None),
         ('email', str, None),
         ('subject', str, None),
         ('comment', str, None),
     ])
     text_id = args.get('text_id')
     chelper = Comment()
     chelper.create(args)
     comments = Comment().get_all(text_id)
     res = Blog().get_one(text_id)
     res['comment'] = comments
     self.result = res
     return True
Esempio n. 4
0
 def post(self, rater, rating, comment_text):
     if comment_text:
         comment_text = urllib2.unquote(comment_text)
         if type(comment_text) == type(""):
             comment_text = comment_text.decode("latin1")
     else:
         comment_text = ""
     rater_rating = RaterRating.update(rater, int(rating), comment_text)
     if rater_rating is not None:
         if comment_text != "":
             Comment.create(comment_text, int(rating), rater_rating.tags)
         self.response.out.write(simplejson.dumps({'rater_id': rater_rating.rater_id, 
                                                   'result': True,
                                                   'pusher_message':make_push_rating_message(rater_rating, comment_text)}))
     else:
         self.error(404)
         self.response.out.write(simplejson.dumps({'rater_id': None, 'result': False}))