File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -121,26 +121,37 @@ async def refresh(self) -> bool:
121121 self ._unknownProducts [actionId ] = product
122122 return refreshed
123123
124+ def hasAction (
125+ self ,
126+ actionDescription : WMS_WebControl_pro_API_actionDescription ,
127+ actionType : WMS_WebControl_pro_API_actionType = None ,
128+ ) -> bool :
129+ for action in self ._actions .values ():
130+ if action .actionDescription == actionDescription and (
131+ actionType is None or actionType == action .actionType
132+ ):
133+ return True
134+ return False
135+
124136 def action (
125137 self ,
126138 actionDescription : WMS_WebControl_pro_API_actionDescription ,
127139 actionType : WMS_WebControl_pro_API_actionType = None ,
128- warnMissing = True ,
129140 ) -> Action :
130141 for action in self ._actions .values ():
131142 if action .actionDescription == actionDescription and (
132143 actionType is None or actionType == action .actionType
133144 ):
134145 return action
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 ,
146+ raise NotImplementedError (
147+ "Failed to find action with description %s and type %s in %s (%s)"
148+ % (
149+ actionDescription .name if actionDescription else "*" ,
150+ actionType .name if actionType else "*" ,
140151 self ,
141152 self ._id ,
142153 )
143- return None
154+ )
144155
145156 def diag (self ) -> dict :
146157 return {
You can’t perform that action at this time.
0 commit comments