def get(self, code): video = g.store.find(Video, code=code).one_or_none() if video is None: g.store.add(Event('VIDEO_STATUS_CHECK', {'code': code})) g.store.commit() return {'eta': Video.get_eta(g.store)} return video.dict(users=is_authenticated())
def decorated(*args, **kwargs): if not is_authenticated(): return message('not_authenticated', 401) return func(*args, **kwargs)
def post(self, code): video = Video.get_or_create(g.store, {'code': code}) user = self.get_resource('user', create=True) video.append(user, ip=get_ip()) g.store.commit() return video.dict(users=is_authenticated())