Part of canonical.launchpad.mail.handlers View In Hierarchy
Method | __init__ | Undocumented |
Method | get | Return the handler for the given email domain. |
Method | add | Adds a handler for a domain. |
Return the handler for the given email domain.
Return None if no such handler exists.
>>> handlers = MailHandlers() >>> handlers.get('bugs.launchpad.net') #doctest: +ELLIPSIS <...MaloneHandler...> >>> handlers.get('no.such.domain') is None True
Adds a handler for a domain.
>>> handlers = MailHandlers() >>> handlers.get('some.domain') is None True >>> handler = object() >>> handlers.add('some.domain', handler) >>> handlers.get('some.domain') is handler True
If there already is a handler for the domain, the old one will get overwritten:
>>> new_handler = object() >>> handlers.add('some.domain', new_handler) >>> handlers.get('some.domain') is new_handler True