
Ok we are running version 2.1.5 on an old White Box server and are encountering this bug which is preventing us from accessing the membership management pages for some (but not all) of our mailing lists.
"if bucket not in digits + '_' + lowercase: TypeError: 'in <string>' requires character as left operand"
I added the '_' to the first line thinking maybe someone used an underscore as the first character in the address and mailman didn't like that but no joy. I asked the Google overlords for an answer with no help (maybe my google-fu needs honing) so I apologize if this is an issue that's been fixed 100 times over.
Any help on what to twiddle would be helpful. It can't be as simple as something like adding '' to the if statement right? My Python skills are quite rudimentary (read: neanderthal).
James Sceets BPL Helpdesk

On 02/04/2015 09:10 AM, James Sceets wrote:
Ok we are running version 2.1.5 on an old White Box server and are encountering this bug which is preventing us from accessing the membership management pages for some (but not all) of our mailing lists.
"if bucket not in digits + '_' + lowercase: TypeError: 'in <string>' requires character as left operand"
I added the '_' to the first line ...
There were some changes in 2.1.12 to allow members whose address begins with a non-alphanumeric character to be visible and retrievable, but before that, such members were just not seen, no bug occurred.
Looking at the 2.1.5 code, it seems the error will maybe occur only if the URL accessing the page has a query fragment of the form 'letter=' or 'letter'. I.e. a URL similar to http://example.com/mailman/admin/listname/members?letter=
The specific code in 2.1.5 is:
qsenviron = os.environ.get('QUERY_STRING')
if qsenviron:
qs = cgi.parse_qs(qsenviron)
bucket = qs.get('letter', 'a')[0].lower()
if bucket not in digits + lowercase:
bucket = None
The TypeError says that bucket is not a character (i.e. string of length 1). It is difficult to see how this could occur at all. If the value of 'letter' exists and does not have length at least 1, qs.get('letter', 'a')[0] will throw an IndexError, and if it's not a string it won't have a .lower() method and that will throw an AttributeError.
So I have to conclude this code is modified in some way beyond adding just the underscore.
In any case, the full error log message with the complete traceback and python and environment info may help me say more.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (2)
-
James Sceets
-
Mark Sapiro