diff options
Diffstat (limited to '')
-rw-r--r-- | Mailman/Cgi/listinfo.py | 13 | ||||
-rw-r--r-- | Mailman/Cgi/subscribe.py | 9 | ||||
-rwxr-xr-x | Mailman/Defaults.py.in | 8 | ||||
-rw-r--r-- | Mailman/Utils.py | 3 |
4 files changed, 20 insertions, 13 deletions
diff --git a/Mailman/Cgi/listinfo.py b/Mailman/Cgi/listinfo.py index b35b8988..81ff7f48 100644 --- a/Mailman/Cgi/listinfo.py +++ b/Mailman/Cgi/listinfo.py @@ -221,18 +221,21 @@ def list_listinfo(mlist, lang): (captcha_question, captcha_box, captcha_idx) = \ Utils.captcha_display(mlist, lang, mm_cfg.CAPTCHAS) pre_question = _( - '''Please answer the following question to prove that - you are not a bot:''' + """Please answer the following question to prove that + you are not a bot:""" ) replacements['<mm-captcha-ui>'] = ( """<tr><td BGCOLOR="#dddddd">%s<br>%s</td><td>%s</td></tr>""" % (pre_question, captcha_question, captcha_box)) else: - captcha_idx = "" # just to have something to include in the hash below + # just to have something to include in the hash below + captcha_idx = '' # fill form replacements['<mm-subscribe-form-start>'] += ( - '<input type="hidden" name="sub_form_token" value="%s:%s:%s">\n' - % (now, captcha_idx, Utils.sha_new(mm_cfg.SUBSCRIBE_FORM_SECRET + ":" + + '<input type="hidden" name="sub_form_token"' + ' value="%s:%s:%s">\n' + % (now, captcha_idx, + Utils.sha_new(mm_cfg.SUBSCRIBE_FORM_SECRET + ":" + now + ":" + captcha_idx + ":" + mlist.internal_name() + ":" + diff --git a/Mailman/Cgi/subscribe.py b/Mailman/Cgi/subscribe.py index 7e7ebc61..ce7940f9 100644 --- a/Mailman/Cgi/subscribe.py +++ b/Mailman/Cgi/subscribe.py @@ -168,7 +168,8 @@ def process_form(mlist, doc, cgidata, lang): # for our hash so it doesn't matter. remote1 = remote.rsplit(':', 1)[0] try: - ftime, fcaptcha_idx, fhash = cgidata.getfirst('sub_form_token', '').split(':') + ftime, fcaptcha_idx, fhash = cgidata.getfirst( + 'sub_form_token', '').split(':') then = int(ftime) except ValueError: ftime = fcaptcha_idx = fhash = '' @@ -193,8 +194,10 @@ def process_form(mlist, doc, cgidata, lang): # Check captcha if isinstance(mm_cfg.CAPTCHAS, dict): captcha_answer = cgidata.getvalue('captcha_answer', '') - if not Utils.captcha_verify(fcaptcha_idx, captcha_answer, mm_cfg.CAPTCHAS): - results.append(_('This was not the right answer to the CAPTCHA question.')) + if not Utils.captcha_verify( + fcaptcha_idx, captcha_answer, mm_cfg.CAPTCHAS): + results.append(_( + 'This was not the right answer to the CAPTCHA question.')) # Was an attempt made to subscribe the list to itself? if email == mlist.GetListEmail(): syslog('mischief', 'Attempt to self subscribe %s: %s', email, remote) diff --git a/Mailman/Defaults.py.in b/Mailman/Defaults.py.in index 401dadc3..594674ca 100755 --- a/Mailman/Defaults.py.in +++ b/Mailman/Defaults.py.in @@ -146,8 +146,8 @@ SUBSCRIBE_FORM_MIN_TIME = seconds(5) # } # The regular expression must match the full string, i.e., it is implicitly # acting as if it had "^" in the beginning and "$" at the end. -# An 'en' key must be present and is used as fall-back if there are no questions -# for the currently set language. +# An 'en' key must be present and is used as fall-back if there are no +# questions for the currently set language. CAPTCHAS = None # Use Google reCAPTCHA to protect the subscription form from spam bots. The @@ -1207,7 +1207,7 @@ DEFAULT_DMARC_MODERATION_ACTION = 0 # with a stronger DMARC policy if such a policy would result in message # modification because dmarc_moderation_action is 1 or 2. Thus, there is # a list setting to apply dmarc_moderaction_action of 1 or 2 to messages -# From: domains with DMARC p=none. Setting this to Yes is only effective if +# From: domains with DMARC p=none. Setting this to Yes is only effective if # dmarc_quarantine_moderaction_action is also Yes. The following is the # default for this setting for new lists. DEFAULT_DMARC_NONE_MODERATION_ACTION = No @@ -1243,7 +1243,7 @@ DMARC_ORGANIZATIONAL_DOMAIN_DATA_URL = \ # (0 to disable). DEFAULT_MEMBER_VERBOSITY_INTERVAL = 300 DEFAULT_MEMBER_VERBOSITY_THRESHOLD = 0 - + # This controls how often to clean old post time entries from the dictionary # used to implement the member verbosity feature. This is a compromise between # using resources for cleaning and allowing the dictionary to grow very large. diff --git a/Mailman/Utils.py b/Mailman/Utils.py index 9ab35a1c..36fbd1f9 100644 --- a/Mailman/Utils.py +++ b/Mailman/Utils.py @@ -1587,7 +1587,8 @@ def captcha_display(mlist, lang, captchas): idx = random.randrange(len(captchas)) question = captchas[idx][0] box_html = mlist.FormatBox('captcha_answer', size=30) - # Remember to encode the language in the index so that we can get it out again! + # Remember to encode the language in the index so that we can get it out + # again! return (websafe(question), box_html, lang + "-" + str(idx)) def captcha_verify(idx, given_answer, captchas): |