class WatchHandler(base.BaseHandler):
@base.authenticated
- def post(self, uuid):
- build = self.backend.builds.get_by_uuid(uuid)
+ async def post(self, uuid):
+ build = await self.backend.builds.get_by_uuid(uuid)
if not build:
raise tornado.web.HTTPError(404, "Could not find build %s" % uuid)
- with self.db.transaction():
- build.add_watcher(self.current_user)
+ # Add the watcher
+ await build.add_watcher(self.current_user)
self.redirect("/builds/%s" % build.uuid)
class UnwatchHandler(base.BaseHandler):
@base.authenticated
- def post(self, uuid):
- build = self.backend.builds.get_by_uuid(uuid)
+ async def post(self, uuid):
+ build = await self.backend.builds.get_by_uuid(uuid)
if not build:
raise tornado.web.HTTPError(404, "Could not find build %s" % uuid)
- with self.db.transaction():
- build.remove_watcher(self.current_user)
+ # Remove the watcher
+ await build.remove_watcher(self.current_user)
self.redirect("/builds/%s" % build.uuid)