Skip to content

Notifications: bugfix when passing instance to the render method #11016

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion readthedocs/notifications/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,18 @@ def _escape_format_values(self, format_values):
If we want to support other types or nested dictionaries,
we will need to iterate recursively to apply the ``escape`` function.
"""
return {
result = {
key: escape(value)
for key, value in format_values.items()
if isinstance(value, (str, int))
}

# TODO: improve this code; I need to hotfix it for now.
# We need to keep passing the "instance" that comes from the notification object itself.
if "instance" in format_values:
result["instance"] = format_values["instance"]
return result

def set_format_values(self, format_values):
self.format_values = self._escape_format_values(format_values)

Expand Down