Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add behavior flags to jinja context #306

Merged
merged 10 commits into from
Sep 12, 2024

Conversation

mikealfare
Copy link
Contributor

Problem

BaseAdapters.behavior is a dynamic property (uses @property). We use @available to make methods available in the jinja context, but this mechanism relies on the method being callable. Using the @property decorator first supplies @available with something that is not callable. Using the @available decorator first adds _is_available_ to the value of the property, but the property object that @property returns does not have the _is_available_ attribute.

Solution

Subclass property and hard code _is_available_ = True on it.

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development, and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX

@mikealfare mikealfare self-assigned this Sep 12, 2024
@cla-bot cla-bot bot added the cla:yes label Sep 12, 2024
Copy link

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@mikealfare mikealfare marked this pull request as ready for review September 12, 2024 19:28
@mikealfare mikealfare requested a review from a team as a code owner September 12, 2024 19:28
@mikealfare mikealfare merged commit 97a6687 into main Sep 12, 2024
15 checks passed
@mikealfare mikealfare deleted the add-behavior-flags-to-jinja-context branch September 12, 2024 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants