Skip to content

Commit

Permalink
Data only processed if not passed in directly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Knucklessg1 committed May 20, 2024
1 parent fa5fed9 commit 17478ec
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
10 changes: 2 additions & 8 deletions servicenow_api/servicenow_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1432,10 +1432,7 @@ def create_change_request_task(
:raises ParameterError: If JSON serialization or deserialization fails.
"""
change_request = ChangeManagementModel(**kwargs)
if (
change_request.change_request_sys_id is None
or change_request.data is None
):
if change_request.change_request_sys_id is None or change_request.data is None:
raise MissingParameterError
try:
response = self._session.post(
Expand Down Expand Up @@ -1657,10 +1654,7 @@ def update_change_request(self, **kwargs) -> Union[Response, requests.Response]:
:raises ParameterError: If JSON serialization or deserialization fails.
"""
change_request = ChangeManagementModel(**kwargs)
if (
change_request.change_request_sys_id is None
or change_request.data is None
):
if change_request.change_request_sys_id is None or change_request.data is None:
raise MissingParameterError
if change_request.change_type:
change_type = f"/{change_request.change_type}"
Expand Down
6 changes: 4 additions & 2 deletions servicenow_api/servicenow_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ def build_api_parameters(cls, values):
# Remove None values
data = {k: v for k, v in data.items() if v is not None}

values["data"] = data
if "data" not in values or values["data"] is None:
values["data"] = data
return values


Expand Down Expand Up @@ -565,7 +566,8 @@ def build_api_parameters(cls, values):
# Remove None values
data = {k: v for k, v in data.items() if v is not None}

values["data"] = data
if "data" not in values or values["data"] is None:
values["data"] = data
return values


Expand Down
2 changes: 1 addition & 1 deletion servicenow_api/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# coding: utf-8

__version__ = '0.20.46'
__version__ = "0.20.46"
__author__ = "Audel Rouhi"
__credits__ = "Audel Rouhi"

0 comments on commit 17478ec

Please sign in to comment.