Skip to content

Commit dae95dd

Browse files
committed
raise error if product base type is not supported but is passed in
1 parent da9c871 commit dae95dd

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

ayon_api/operations.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from typing import Optional, Any, Iterable
1010

1111
from ._api import get_server_api_connection
12+
from .exceptions import UnsupportedServerVersion
1213
from .utils import create_entity_id, REMOVED_VALUE, NOT_SET
1314

1415
if typing.TYPE_CHECKING:
@@ -1267,6 +1268,14 @@ def create_product(
12671268
"folderId": folder_id,
12681269
}
12691270

1271+
if (
1272+
product_base_type
1273+
and not self._con.is_product_base_type_supported()
1274+
):
1275+
raise UnsupportedServerVersion(
1276+
"Product base type is not supported for your server version."
1277+
)
1278+
12701279
for key, value in (
12711280
("attrib", attrib),
12721281
("data", data),
@@ -1321,6 +1330,14 @@ def update_product(
13211330
UpdateOperation: Object of update operation.
13221331
13231332
"""
1333+
if (
1334+
product_base_type
1335+
and not self._con.is_product_base_type_supported()
1336+
):
1337+
raise UnsupportedServerVersion(
1338+
"Product base type is not supported for your server version."
1339+
)
1340+
13241341
update_data = {
13251342
key: value
13261343
for key, value in (

0 commit comments

Comments
 (0)