------------------------------------------------------------
revno: 1537
committer: Mark Sapiro <[email protected]>
branch nick: 2.1
timestamp: Sat 2015-02-07 23:54:26 -0800
message:
Cleaned the code a bit. No change in results.
modified:
Mailman/versions.py
--
lp:mailman/2.1
https://code.launchpad.net/~mailman-coders/mailman/2.1
Your team Mailman Checkins is subscribed to branch lp:mailman/2.1.
To unsubscribe from this branch go to
https://code.launchpad.net/~mailman-coders/mailman/2.1/+edit-subscription
=== modified file 'Mailman/versions.py'
--- Mailman/versions.py 2015-02-07 20:44:08 +0000
+++ Mailman/versions.py 2015-02-08 07:54:26 +0000
@@ -110,28 +110,20 @@
"""Recursively process lists, tuples and dictionary values and
convert strings as needed. Return either the updated item or None
if no change."""
+ changed = False
if isinstance(v, str):
- nv = convert(v, f, t)
- if nv == v:
- return None
- else:
- return nv
+ return convert(v, f, t)
elif isinstance(v, list):
- changed = False
- nl = []
for i in range(len(v)):
nv = doitem(v[i], f, t)
if nv:
changed = True
- nl += [nv]
- else:
- nl += v[i]
+ v[i] = nv
if changed:
- return nl
+ return v
else:
return None
elif isinstance(v, tuple):
- changed = False
nt = ()
for i in range(len(v)):
nv = doitem(v[i], f, t)
@@ -145,17 +137,13 @@
else:
return None
elif isinstance(v, dict):
- changed = False
- nd = {}
for k, ov in v.items():
nv = doitem(ov, f, t)
if nv:
changed = True
- nd[k] = nv
- else:
- nd[k] = ov
+ v[k] = nv
if changed:
- return nd
+ return v
else:
return None
else:
@@ -178,7 +166,7 @@
if is_f and not is_t:
return u.encode(t, 'replace')
else:
- return s
+ return None
# Migrate to 2.1b3, baw 17-Aug-2001
if hasattr(l, 'dont_respond_to_post_requests'):
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org