1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
10 from google.appengine.api import users
13 class InternalAlertsHandler(alerts.AlertsHandler):
14 MEMCACHE_INTERNAL_ALERTS_KEY = 'internal-alerts'
16 # Has no 'request' member.
17 # Has no 'response' member.
18 # Use of super on an old style class.
19 # pylint: disable=E1002,E1101
21 # Require users to be logged to see builder alerts from private/internal
23 user = users.get_current_user()
27 'date': datetime.datetime.utcnow(),
28 'redirect-url': users.create_login_url(self.request.uri)})
29 uncompressed = super(InternalAlertsHandler,
30 self).generate_json_dump(alerts)
31 super(InternalAlertsHandler, self).send_json_data(uncompressed)
35 if not email.endswith('@google.com'):
36 self.response.set_status(403, 'invalid user')
39 super(InternalAlertsHandler, self).get_from_memcache(
40 InternalAlertsHandler.MEMCACHE_INTERNAL_ALERTS_KEY)
43 super(InternalAlertsHandler, self).post_to_memcache(
44 InternalAlertsHandler.MEMCACHE_INTERNAL_ALERTS_KEY)
47 app = webapp2.WSGIApplication([
48 ('/internal-alerts', InternalAlertsHandler)])