mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 12:56:02 -04:00
Use direct references for some configuration variables (part 3) (#10885)
This avoids the overhead of searching through the various configuration classes by directly referencing the class that the attributes are in. It also improves type hints since mypy can now resolve the types of the configuration variables.
This commit is contained in:
parent
aa2c027792
commit
e584534403
32 changed files with 137 additions and 119 deletions
|
@ -119,14 +119,16 @@ class ModuleApi:
|
|||
self.custom_template_dir = hs.config.server.custom_template_directory
|
||||
|
||||
try:
|
||||
app_name = self._hs.config.email_app_name
|
||||
app_name = self._hs.config.email.email_app_name
|
||||
|
||||
self._from_string = self._hs.config.email_notif_from % {"app": app_name}
|
||||
self._from_string = self._hs.config.email.email_notif_from % {
|
||||
"app": app_name
|
||||
}
|
||||
except (KeyError, TypeError):
|
||||
# If substitution failed (which can happen if the string contains
|
||||
# placeholders other than just "app", or if the type of the placeholder is
|
||||
# not a string), fall back to the bare strings.
|
||||
self._from_string = self._hs.config.email_notif_from
|
||||
self._from_string = self._hs.config.email.email_notif_from
|
||||
|
||||
self._raw_from = email.utils.parseaddr(self._from_string)[1]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue