diff options
| author | Barry Warsaw | 2008-03-30 22:55:22 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2008-03-30 22:55:22 -0400 |
| commit | 898678d457422ba6a0a858362995b30a94fd758f (patch) | |
| tree | 1b2457513fcbf56f4afc4f7c501935faf01e5a86 /mailman/SafeDict.py | |
| parent | 0e1c2be3e6110ccece3cbd0ebc5bfd0eb76c3aad (diff) | |
| download | mailman-898678d457422ba6a0a858362995b30a94fd758f.tar.gz mailman-898678d457422ba6a0a858362995b30a94fd758f.tar.zst mailman-898678d457422ba6a0a858362995b30a94fd758f.zip | |
Diffstat (limited to 'mailman/SafeDict.py')
| -rw-r--r-- | mailman/SafeDict.py | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/mailman/SafeDict.py b/mailman/SafeDict.py index 1db43a760..1549777da 100644 --- a/mailman/SafeDict.py +++ b/mailman/SafeDict.py @@ -53,34 +53,3 @@ class SafeDict(dict): if isinstance(v, str): self.__setitem__(k, unicode(v, self.cset)) return template % self - - - -class MsgSafeDict(SafeDict): - def __init__(self, msg, d=None): - self.__msg = msg - if d is None: - d = {} - super(MsgSafeDict, self).__init__(d) - - def __getitem__(self, key): - if key.startswith('msg_'): - return self.__msg.get(key[4:], 'n/a') - elif key.startswith('allmsg_'): - missing = [] - all = self.__msg.get_all(key[7:], missing) - if all is missing: - return 'n/a' - return COMMASPACE.join(all) - else: - return super(MsgSafeDict, self).__getitem__(key) - - def copy(self): - d = super(MsgSafeDict, self).copy() - for k in self.__msg.keys(): - vals = self.__msg.get_all(k) - if len(vals) == 1: - d['msg_'+k.lower()] = vals[0] - else: - d['allmsg_'+k.lower()] = COMMASPACE.join(vals) - return d |
