def POST(self, category): i = web.input(id=None, redirect_url=None) redirect_url = i.redirect_url or web.ctx.get('HTTP_REFERRER') id = i.id and safeint(i.id, None) if id: db.touch(id) raise web.seeother(redirect_url) else: return 'no such id: %s' % id
def sync(ro_id): url = config.api_url + str(ro_id) + '/sync/?workflow=' + str(workflow) print url try: start = time.time() contents = urllib2.urlopen(url).read() db.touch(ro_id, time.time() - start) write_result(ro_id, contents) except urllib2.HTTPError as err: lib.handle_err(err, url)