generated from opensafely-core/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The sandbox method of evaluating and rendering ehrql objects was via monkey patching various repr functions The initial debug implementation re-used this method, and manually called `repr()` from within the show() call. Now that we don't have a sandbox, all rendering can be done explicitly by the show() function, so there is no need for repr monkey patching. This refactor switches the evaluate/render steps to be done explicitly in show(), rather than going via repr. However, the repr monkey patching implementation used a closure to capture the supplied renderer and engine details in the monkeypatched function. As `show()` is a user imported static function, it cannot use a closure. Instead, we formalize the DEBUG_QUERY_ENGINE global into a new DEBUG_CONTEXT global, which is set via `activate_debug_context`, and then available to use inside `show()`. This DEBUG_CONTEXT stores the engine instance and the renderer, and knows how to render and object with those.
- Loading branch information
1 parent
dccb00a
commit a5052f2
Showing
5 changed files
with
87 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters