Callables for is_now?
benwhalley opened this issue · 1 comments
benwhalley commented
I wonder if you'd considered allowing callable for is_now and was conditions? For example, if this function:
def _check_is_now_condition(self, field_name: str, specs: dict) -> bool:
return specs["is_now"] in (self._current_value(field_name), "*")
Was changed to something like:
def _check_is_now_condition(self, field_name: str, specs: dict) -> bool:
if callable(specs["is_now"]):
return specs["is_now"](self)
else:
return specs["is_now"] in (self._current_value(field_name), "*")
Then users could pass a callable and implement any logic they like in relation to the tested values.
rsinger86 commented
That's interesting. I had not considered it. Is there a specific use case you're working on? Might be helpful for us to have something to work backward from.