Skip to content

Commit

Permalink
Add: Add an add_filter method to XmlCommand
Browse files Browse the repository at this point in the history
Allow to set a filter on an XmlCommand instance. This allows to
deprecated the add_filter utils function.
  • Loading branch information
bjoernricks authored and greenbonebot committed Jun 14, 2024
1 parent 6475ff7 commit 5d38591
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions gvm/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,19 @@ class XmlCommand(XmlCommandElement):
def __init__(self, name: str) -> None:
super().__init__(create_element(name))

def add_filter(
self,
filter_string: Optional[str],
filter_id: Optional[str],
) -> "XmlCommand":
if filter_string:
self.set_attribute("filter", filter_string)

if filter_id:
self.set_attribute("filt_id", filter_id)

return self


def pretty_print(
xml: Union[str, List[Union[Element, str]], Element],
Expand Down

0 comments on commit 5d38591

Please sign in to comment.