Skip to content
This repository was archived by the owner on May 29, 2024. It is now read-only.
This repository was archived by the owner on May 29, 2024. It is now read-only.

Improve usage of _resolve_variable method  #2

@toirl

Description

@toirl

The method _resolve_variable is used to resolve a $foo variable within a rule into a pythonic value . The valuea are given in a dictionary. So if the dictionary contains a value for the key "foo" the value will be returned. Otherwise a error is logged if the value can not be found.

The problem with this behavior is that the logging is done regardless on the context in which the function is called. Consider the following rule:

bool($foo) with a empty dictionary. Currently the foo variable would be resolved and the bool method is called with the result. Logging the fact that the variable is missing is senseless here because the bool method is used to check if a value is present. In this case a missing value is an expected case and should not be logged.

An improvement might be to call the method not globally but in context of a specific function. So the bool method may catch the case the the value is missing and silently continue while other functions can log or even raise an exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions