def post(self): url = self.request.get('url') if url and len(url): deferred = self.request.get('deferred') key = page.create(url) if not deferred: url = page.resolve(url) if url: page.store(key, url) else: taskqueue.add(url='/deferred', params=dict(url=url, key=key)) if key and url: self.response.set_status(201) self.response.headers['Location'] = '%s/%s' % (self.request.host_url, key) self.response.clear() else: self.response.set_status(404) else: self.response.set_status(400)
def create(check, variant=Text.HEAD): check.valid_email() page.create(check) check.other('instance_without_norms', not c.instance.use_norms) check.other('instance_frozen', c.instance.frozen)
def create(variant=Text.HEAD): return has('instance.admin') and page.create() and \ c.instance.use_norms and not c.instance.frozen