Skip to content

Commit 56ca0ef

Browse files
Itou-Ngmayneyao
authored andcommitted
style: lacking space_id raise Exception but not NameError.
1 parent dc1d9d1 commit 56ca0ef

File tree

4 files changed

+3
-9
lines changed

4 files changed

+3
-9
lines changed

vika/datasheet/datasheet.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,12 @@ def create_field(self, data) -> PostMetaFieldResponse:
8787
8888
:param dic data: api请求体,结构:{'type': str, 'name': str, 'property': obj}
8989
:return: 字段创建api返回结果
90-
:raises NameError: 缺少空间id信息
9190
:raises ServerError: 服务端错误
9291
:raises ResponseBodyParserError: 解析响应体失败
9392
:raises Exception: 其他异常,如:字段重名
9493
"""
9594
if self.spc_id is None:
96-
raise NameError('maybe: vika.datasheet("dst_id") => vika.space("spc_id").datasheet("dst_id")')
95+
raise Exception('maybe: vika.datasheet("dst_id") => vika.space("spc_id").datasheet("dst_id")')
9796
api_endpoint = urljoin(self.vika.api_base,
9897
f"/fusion/v1/spaces/{self.spc_id}/datasheets/{self.id}/fields")
9998
resp = self.vika.request.post(api_endpoint, json=data)
@@ -104,13 +103,12 @@ def delete_field(self, field_id: str) -> bool:
104103
105104
:param str field_id: 字段id
106105
:return: 字段是否删除成功
107-
:raises NameError: 缺少空间id信息
108106
:raises ServerError: 服务端错误
109107
:raises ResponseBodyParserError: 解析响应体失败
110108
:raises Exception: 其他异常,如:
111109
"""
112110
if self.spc_id is None:
113-
raise NameError('maybe: vika.datasheet("dst_id") => vika.space("spc_id").datasheet("dst_id")')
111+
raise Exception('maybe: vika.datasheet("dst_id") => vika.space("spc_id").datasheet("dst_id")')
114112
api_endpoint = urljoin(self.vika.api_base,
115113
f"/fusion/v1/spaces/{self.spc_id}/datasheets/{self.id}/fields/{field_id}")
116114
resp = self.vika.request.delete(api_endpoint)

vika/datasheet/datasheet_manager.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ def create(self, data) -> PostDatasheetMetaResponseData:
1313
1414
:param dict data: 新建表格属性
1515
:return: 新建表格id、创建时间戳和字段id、name信息
16-
:raises NameError: 缺少空间id信息
1716
:raises ServerError: 服务端错误
1817
:raises ResponseBodyParserError: 解析响应体失败
1918
:raises Exception: 其他异常

vika/datasheet/field_manager.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ def create(self, data) -> Optional[MetaField]:
8484
8585
:param dict data: 新建字段属性
8686
:return: 新建字段id和name
87-
:raises NameError: 缺少空间id信息
8887
:raises ServerError: 服务端错误
8988
:raises ResponseBodyParserError: 解析响应体失败
9089
:raises Exception: 其他异常,如:字段重名
@@ -105,7 +104,6 @@ def delete(self, fid_id: str) -> bool:
105104
106105
:param str fid_id: 要删除的字段信息
107106
:return: 删除成功返回ture
108-
:raises NameError: 缺少空间id信息
109107
:raises ServerError: 服务端错误
110108
:raises ResponseBodyParserError: 解析响应体失败
111109
:raises Exception: 其他异常,如:字段id不存在

vika/space/space.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,12 @@ def create_datasheet(self, data) -> PostDatasheetMetaResponse:
3535
3636
:param dic data: api请求体,结构:{'name': 'table_name'}
3737
:return: 创建表格响应数据
38-
:raises NameError: 缺少空间id信息
3938
:raises ServerError: 服务端错误
4039
:raises ResponseBodyParserError: 解析响应体失败
4140
:raises Exception: 其他异常
4241
"""
4342
if self.id is None:
44-
raise NameError('maybe: vika.datasheet("dst_id") => vika.space("spc_id").datasheet("dst_id")')
43+
raise Exception('maybe: vika.datasheet("dst_id") => vika.space("spc_id").datasheet("dst_id")')
4544
api_endpoint = urljoin(self.vika.api_base,
4645
f"/fusion/v1/spaces/{self.id}/datasheets")
4746
resp = self.vika.request.post(api_endpoint, json=data)

0 commit comments

Comments
 (0)