Skip to content

Commit

Permalink
Сделать предупреждение, что tasks.* — тупая ветка методов, там только…
Browse files Browse the repository at this point in the history
… call_raw, а не call

Fixes #239
  • Loading branch information
leshchenko1979 committed Jul 23, 2024
1 parent 8e1fb6f commit 62ef8cd
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions fast_bitrix24/user_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ class GetAllUserRequest(UserRequestAbstract):
"get_all() doesn't support parameters 'start' or 'order'",
)
@icontract.require(
lambda self: not self.st_method.startswith("tasks.elapseditem."),
"get_all() shouldn't be used with 'tasks.elapseditem.*' method group. "
lambda self: not self.st_method.startswith("tasks."),
"get_all() shouldn't be used with 'tasks.*' method group. "
"Use call(raw=True) instead. Read more: "
"https://github.com/leshchenko1979/fast_bitrix24/issues/199",
)
Expand Down Expand Up @@ -270,6 +270,12 @@ def __init__(
"get_by_ID(): 'ID_list' should be a Sequence "
"if a progress bar is to be displayed",
)
@icontract.require(
lambda self: not self.st_method.startswith("tasks."),
"get_by_ID() shouldn't be used with 'tasks.*' method group. "
"Use call(raw=True) instead. Read more: "
"https://github.com/leshchenko1979/fast_bitrix24/issues/199",
)
def check_special_limitations(self):
return True

Expand Down Expand Up @@ -307,6 +313,12 @@ def __init__(self, bitrix, method: str, item_list: Union[Dict, Iterable[Dict]]):
"call(): 'ID_list' should be a Sequence "
"if a progress bar is to be displayed",
)
@icontract.require(
lambda self: not self.st_method.startswith("tasks."),
"call(raw=False) shouldn't be used with 'tasks.*' method group. "
"Use call(raw=True) instead. Read more: "
"https://github.com/leshchenko1979/fast_bitrix24/issues/199",
)
def check_special_limitations(self):
if self.st_method.endswith(GET_ALL_ENDINGS):
warnings.warn(
Expand Down

0 comments on commit 62ef8cd

Please sign in to comment.