oca-ocb-core/odoo-bringout-oca-ocb-base/odoo/_monkeypatches/email.py
Ernad Husremovic 2d3ee4855a 19.0 vanilla
2026-03-09 09:30:27 +01:00

16 lines
533 B
Python

from email._policybase import _PolicyBase
def patch_module():
def policy_clone(self, **kwargs):
for arg in kwargs:
if arg.startswith("_") or "__" in arg:
raise AttributeError(f"{self.__class__.__name__!r} object has no attribute {arg!r}")
return orig_policy_clone(self, **kwargs)
def policy_add(self, other):
return policy_clone(self, **other.__dict__)
orig_policy_clone = _PolicyBase.clone
_PolicyBase.clone = policy_clone
_PolicyBase.__add__ = policy_add