viur-framework / viur-core

The core component of ViUR, the Python framework for modern web development.
https://www.viur.dev
MIT License
13 stars 14 forks source link

refactor: Send emails from `EmailTransport` instances instead of class #1250

Closed sveneberth closed 2 months ago

sveneberth commented 3 months ago

This allows to store the credentials and other settings on the instance itself and reduce the config size. Furthermore I think this is more pythonic, combines what belongs together and makes abc meaningful.

This a small breaking change. Instead of

conf.email.mailjet_api_key = secret.get("api-mailjet-key")
conf.email.mailjet_api_secret = secret.get("api-mailjet-secret")
conf.email.transport_class = EmailTransportMailjet

you write now

conf.email.transport_class = EmailTransportMailjet(
    api_key=secret.get("api-mailjet-key"),
    secret_key=secret.get("api-mailjet-secret"),
)

Furthermore

Resolves #813

sveneberth commented 3 months ago

This pull request is in conflict with #1249, can you please integrate it here and fix the config first

Yeah, I expected this.

I will resolve the conflicts and do the renamings later.

sveneberth commented 3 months ago

@phorward @ArneGudermann @KadirBalku I'm now done, you can review now :)