示例#1
0
文件: resources.py 项目: pglass/Rift
 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})
示例#2
0
 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})
示例#3
0
文件: resources.py 项目: pglass/Rift
    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})
示例#4
0
    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})