Skip to content

Conversation

@mgax
Copy link
Member

@mgax mgax commented Aug 6, 2025

Fixes #80.

def get_newsletter_html(self, extra_context=None) -> SafeString:
context = self.get_newsletter_context()
if extra_context:
context = copy(context)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: why copy the context dict? It seems like an unnecessary step given that it isn't reused. If observing immutability of the dict is important for some reason, you could use the dict union operator and skip the import.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a bit of paranoia in case people do something silly.

I thought being explicit was better, but now I like the ** approach better. Changed in 0747582. Thanks!

@mgax mgax merged commit b501f40 into main Aug 14, 2025
7 checks passed
@mgax mgax deleted the feature/extra-template-context branch August 14, 2025 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

get_newsletter_html should accept extra context

3 participants