Beispiel #1
0
 def post(self):
     news_id = self.request.get_range('news_id')
     news = News.get_by_id(news_id)
     if not news:
         self.abort(400)
     if news.status == STATUS_ACTIVE:
         news.deactivate()
Beispiel #2
0
    def post(self):
        news_id = self.request.get_range('news_id')
        news = News.get_by_id(news_id)
        if not news:
            self.abort(400)
        if news.status == STATUS_CREATED:
            news.activate()

        if news.notification is not None:
            self.send_notification(news=news)
            pass
 def post(self):
     news_id = self.request.get_range('news_id')
     news = News.get_by_id(news_id)
     if not news:
         self.abort(400)
     if news.status in [STATUS_CREATED, STATUS_ACTIVE]:
         news.cancel()
         self.render_json({
             'success': True,
             'news_id': news_id,
             'status_str': NOTIFICATION_STATUS_MAP[news.status]
         })
     else:
         self.render_json({
             'success': False
         })