-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Proposal: Refactor render to create InertiaResponse class (#61)
* Refactor to class based views * Refactor to class based views * cleanup * move to a mixin for better flexibility * PR review feedback
- Loading branch information
1 parent
ac19cfa
commit 0951ab7
Showing
9 changed files
with
226 additions
and
97 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .http import inertia, render, location | ||
from .http import inertia, render, location, InertiaResponse | ||
from .utils import lazy, optional, defer, merge | ||
from .share import share |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
def deep_transform_callables(prop): | ||
if not isinstance(prop, dict): | ||
return prop() if callable(prop) else prop | ||
|
||
for key in list(prop.keys()): | ||
prop[key] = deep_transform_callables(prop[key]) | ||
|
||
return prop | ||
|
||
def validate_type(value, name, expected_type): | ||
if not isinstance(value, expected_type): | ||
raise TypeError(f"Expected {expected_type.__name__} for {name}, got {type(value).__name__}") | ||
|
||
return value |
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
Oops, something went wrong.