class twisted.mail.mail.DomainWithDefaultDict: (source)
A simulated dictionary for mapping domain names to domain objects with a default value for non-existing keys.
Instance Variable | domains | See __init__ |
Instance Variable | default | See __init__ |
Method | __init__ | |
Method | setDefaultDomain | Set the default domain. |
Method | has_key | Test for the presence of a domain name in this dictionary. |
Class Method | fromkeys | Create a new DomainWithDefaultDict with the specified keys. |
Method | __contains__ | Test for the presence of a domain name in this dictionary. |
Method | __getitem__ | Look up a domain name and, if it is present, return the domain object associated with it. Otherwise return the default domain. |
Method | __setitem__ | Associate a domain object with a domain name in this dictionary. |
Method | __delitem__ | Delete the entry for a domain name in this dictionary. |
Method | __iter__ | Return an iterator over the domain names in this dictionary. |
Method | __len__ | Return the number of domains in this dictionary. |
Method | __str__ | Build an informal string representation of this dictionary. |
Method | __repr__ | Build an "official" string representation of this dictionary. |
Method | get | Look up a domain name in this dictionary. |
Method | copy | Make a copy of this dictionary. |
Method | iteritems | Return an iterator over the domain name/domain object pairs in the dictionary. |
Method | iterkeys | Return an iterator over the domain names in this dictionary. |
Method | itervalues | Return an iterator over the domain objects in this dictionary. |
Method | keys | Return a list of all domain names in this dictionary. |
Method | values | Return a list of all domain objects in this dictionary. |
Method | items | Return a list of all domain name/domain object pairs in this dictionary. |
Method | popitem | Remove a random domain name/domain object pair from this dictionary and return it as a tuple. |
Method | update | Update this dictionary with domain name/domain object pairs from another dictionary. |
Method | clear | Remove all items from this dictionary. |
Method | setdefault | Return the domain object associated with the domain name if it is present in this dictionary. Otherwise, set the value for the domain name to the default and return that value. |
Set the default domain.
Parameters | domain | The default domain. (type: IDomain provider) |
Create a new DomainWithDefaultDict
with the specified keys.
Parameters | klass | Undocumented |
keys | Domain names to serve as keys in the new dictionary. (type: iterable of bytes ) | |
value | A domain object to serve as the value for all new keys in the dictionary. (type: None or IDomain provider) | |
Returns | A new dictionary. (type: DomainWithDefaultDict ) |
Delete the entry for a domain name in this dictionary.
Parameters | name | A domain name. (type: bytes ) |
Return an iterator over the domain names in this dictionary.
Returns | An iterator over the domain names. (type: iterator over bytes ) |
Return the number of domains in this dictionary.
Returns | The number of domains in this dictionary. (type: int ) |
Build an informal string representation of this dictionary.
Returns | A string containing the mapping of domain names to domain objects. (type: bytes ) |
Build an "official" string representation of this dictionary.
Returns | A pseudo-executable string describing the underlying domain mapping of this object. (type: bytes ) |
Look up a domain name in this dictionary.
Parameters | key | A domain name. (type: bytes ) |
default | A domain object to be returned if the domain name is not in this dictionary. (type: IDomain provider or None ) | |
Returns | The domain object associated with the domain name if it is in this dictionary. Otherwise, the default value. (type: IDomain provider or None ) |
Make a copy of this dictionary.
Returns | A copy of this dictionary. (type: DomainWithDefaultDict ) |
Return an iterator over the domain name/domain object pairs in the dictionary.
Using the returned iterator while adding or deleting entries from the dictionary may result in a RuntimeError
or failing to iterate over all the domain name/domain object pairs.
Returns | An iterator over the domain name/domain object pairs. (type: iterator over 2-tuple of (1) bytes , (2) IDomain provider or None ) |
Return an iterator over the domain names in this dictionary.
Using the returned iterator while adding or deleting entries from the dictionary may result in a RuntimeError
or failing to iterate over all the domain names.
Returns | An iterator over the domain names. (type: iterator over bytes ) |
Return an iterator over the domain objects in this dictionary.
Using the returned iterator while adding or deleting entries from the dictionary may result in a RuntimeError
or failing to iterate over all the domain objects.
Returns | An iterator over the domain objects. (type: iterator over IDomain provider or None ) |
Update this dictionary with domain name/domain object pairs from another dictionary.
When this dictionary contains a domain name which is in the other dictionary, its value will be overwritten.
Parameters | other | Another dictionary of domain name/domain object pairs. (type: dict of bytes -> IDomain provider and/or bytes -> None ) |
Returns | None. (type: None ) |
Return the domain object associated with the domain name if it is present in this dictionary. Otherwise, set the value for the domain name to the default and return that value.
Parameters | key | A domain name. (type: bytes ) |
default | A domain object. (type: IDomain provider) | |
Returns | The domain object associated with the domain name. (type: IDomain provider or None ) |