Skip to content

Commit 70babd4

Browse files
committed
Make it possible to disable missing action warning
1 parent ed820d2 commit 70babd4

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

wmspro/destination.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,21 @@ def action(
125125
self,
126126
actionDescription: WMS_WebControl_pro_API_actionDescription,
127127
actionType: WMS_WebControl_pro_API_actionType = None,
128+
warnMissing=True,
128129
) -> Action:
129130
for action in self._actions.values():
130131
if action.actionDescription == actionDescription and (
131132
actionType is None or actionType == action.actionType
132133
):
133134
return action
134-
_LOGGER.warning(
135-
"Failed to get action with description %s and type %s in %s (%s)",
136-
actionDescription,
137-
actionType,
138-
self,
139-
self._id,
140-
)
135+
if warnMissing:
136+
_LOGGER.warning(
137+
"Failed to get action with description %s and type %s in %s (%s)",
138+
actionDescription.name,
139+
actionType.name if actionType else None,
140+
self,
141+
self._id,
142+
)
141143
return None
142144

143145
def diag(self) -> dict:

0 commit comments

Comments
 (0)