def on_get(self, req, resp, tenant_id): tenant = Tenant.get_tenant(tenant_id) if tenant: resp.body = self.format_response_body(tenant.as_dict()) else: msg = 'Cannot find tenant: {tenant_id}'.format(tenant_id=tenant_id) resp.status = falcon.HTTP_404 resp.body = json.dumps({'description': msg})
def on_get(self, req, resp, tenant_id): tenant = Tenant.get_tenant(tenant_id) if tenant: resp.body = self.format_response_body(tenant.as_dict()) else: msg = 'Cannot find tenant: {tenant_id}'.format(tenant_id=tenant_id) resp.status = falcon.HTTP_404 resp.body = json.dumps({'description': msg})
def on_put(self, req, resp, tenant_id): tenant = Tenant.get_tenant(tenant_id) if tenant: body = self.load_body(req) body['tenant_id'] = tenant_id tenant = Tenant.build_tenant_from_dict(body) Tenant.update_tenant(tenant) else: msg = 'Cannot find tenant: {tenant_id}'.format(tenant_id=tenant_id) resp.status = falcon.HTTP_404 resp.body = json.dumps({'description': msg})
def on_put(self, req, resp, tenant_id): tenant = Tenant.get_tenant(tenant_id) if tenant: body = self.load_body(req) body['tenant_id'] = tenant_id tenant = Tenant.build_tenant_from_dict(body) Tenant.update_tenant(tenant) else: msg = 'Cannot find tenant: {tenant_id}'.format(tenant_id=tenant_id) resp.status = falcon.HTTP_404 resp.body = json.dumps({'description': msg})