def getDownload(self, id): download = Download.get(Download.id == id) tasks.snatchOne(download.element, [download]) download = Download.get(Download.id == id) if download.status == common.SNATCHED: return json.dumps({'result': True, 'data': {'element_id': download.element.id, 'status_id': download.status.id}, 'msg': u'%s was snatched' % (download.name)}) else: return json.dumps({'result': False, 'data': [], 'msg': u'%s not was snatched' % (download.name)})
def getDownload(self, id): download = Download.get(Download.id == id) tasks.snatchOne(download.element, [download]) self.redirect('/')