From 51e3e31ed3ea0b2cb73156fc20fe556cb261a174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 19 Sep 2016 17:47:42 +0200 Subject: [PATCH] qubes/firewall: make xml parameter to Rule optional QubesOS/qubes-issues#1815 --- qubes/firewall.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/qubes/firewall.py b/qubes/firewall.py index 671d6674..61b511b1 100644 --- a/qubes/firewall.py +++ b/qubes/firewall.py @@ -204,7 +204,12 @@ def rule(self): class Rule(qubes.PropertyHolder): - def __init__(self, xml, **kwargs): + def __init__(self, xml=None, **kwargs): + '''Single firewall rule + + :param xml: XML element describing rule, or None + :param kwargs: rule elements + ''' super(Rule, self).__init__(xml, **kwargs) self.load_properties() self.events_enabled = True @@ -347,7 +352,7 @@ def from_xml_v1(cls, node, action): if expire: kwargs['expire'] = expire - return cls(None, **kwargs) + return cls(**kwargs) def __eq__(self, other): return self.rule == other.rule