[Mailman-Users] send_digests() issue w/ Mailman 2.1.26

Mark Sapiro mark at msapiro.net
Mon Mar 12 19:10:56 EDT 2018


On 03/12/2018 03:33 PM, Dave Pascoe wrote:
> Sending digests has broken on upgrade to either 2.1.25 or 2.1.26....2.1.26
> I'm pretty sure.
> 
> Getting this error:
> 
> Mar 12 17:50:55 2018 (17857) send_digests() failed: decode() takes no
> keyword arguments
> Mar 12 17:50:55 2018 (17857) Traceback (most recent call last):
>   File "/usr/local/mailman/Mailman/Handlers/ToDigest.py", line 110, in
> process
>     send_digests(mlist, mboxfp)
>   File "/usr/local/mailman/Mailman/Handlers/ToDigest.py", line 158, in
> send_digests
>     send_i18n_digests(mlist, mboxfp)
>   File "/usr/local/mailman/Mailman/Handlers/ToDigest.py", line 313, in
> send_i18n_digests
>     toctext = to_cset_out(toc.getvalue(), lcset)
>   File "/usr/local/mailman/Mailman/Handlers/ToDigest.py", line 77, in
> to_cset_out
>     return text.decode(lcset, errors='replace').encode(ocset,
> TypeError: decode() takes no keyword arguments
> 
> This is on a soon-to-be-upgraded CentOS 5 system so Python 2.4.3. Any quick
> fix for ToDigest.py to make it temporarily compatible with Python 2.4.3?


As you surmise, you have discovered another Python dependency. This was
introduced in 2.1.24 and depends on Python 2.7.

The fix for Python 2.3 - 2.6 is simple. Part of the added code in
Handlers/ToDigest.py is:

> def to_cset_out(text, lcset):
>     # Convert text from unicode or lcset to output cset.
>     ocset = Charset(lcset).get_output_charset() or lcset
>     if isinstance(text, unicode):
>         return text.encode(ocset, errors='replace')
>     else:
>         return text.decode(lcset, errors='replace').encode(ocset,
>                                                            errors='replace')

In both of the return statements, just delete errors= so it becomes

> def to_cset_out(text, lcset):
>     # Convert text from unicode or lcset to output cset.
>     ocset = Charset(lcset).get_output_charset() or lcset
>     if isinstance(text, unicode):
>         return text.encode(ocset, 'replace')
>     else:
>         return text.decode(lcset, 'replace').encode(ocset, 'replace')

-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan


More information about the Mailman-Users mailing list