Skip to content

Commit 76420e6

Browse files
committed
Fix Rule constructor kwargs not being consumed properly
1 parent 614988d commit 76420e6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

p4pillon/sharednt.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def __init__(
8181

8282
if nttype:
8383
for registered_handler in self.registered_handlers:
84-
name, component_handler = self.__setup_registered_rule(registered_handler, nttype, **kwargs)
84+
name, component_handler, kwargs = self.__setup_registered_rule(registered_handler, nttype, **kwargs)
8585
if name and component_handler:
8686
handler[name] = component_handler
8787

@@ -221,7 +221,7 @@ def on_close(self):
221221

222222
def __setup_registered_rule(
223223
self, class_to_instantiate: type[BaseRule], nttype, **kwargs
224-
) -> tuple[str | None, ComposeableRulesHandler | None]:
224+
) -> tuple[str | None, ComposeableRulesHandler | None, dict[str, Any]]:
225225
"""The existence of a single function that does everything suggests this is the wrong approach!"""
226226

227227
# Examine the class member variables to determine how/whether to setup this Rule
@@ -233,7 +233,7 @@ def __setup_registered_rule(
233233

234234
# If we're not relying on the rule to provide enough information to configure itself then
235235
if not auto_add and name not in kwargs:
236-
return (name, None)
236+
return (name, None, kwargs)
237237

238238
# Perform tests on whether the rule is applicable to the nttype and/or the fields
239239
if supported_nttypes:
@@ -245,7 +245,7 @@ def __setup_registered_rule(
245245
if required_fields:
246246
for required_field in required_fields:
247247
if required_field not in nttype:
248-
return (name, None)
248+
return (name, None, kwargs)
249249

250250
# See if there's an attempt to pass arguments to the constructor of this Rule
251251
args = {}
@@ -262,4 +262,4 @@ def __setup_registered_rule(
262262
else:
263263
composed_instance = ComposeableRulesHandler(instance)
264264

265-
return (name, composed_instance)
265+
return (name, composed_instance, kwargs)

0 commit comments

Comments
 (0)