[Mailman-Users] Rejection notice substitution variables(member_moderation_notice)

Mark Sapiro mark at msapiro.net
Thu Aug 21 16:51:29 CEST 2008


Rodriguez Gomez Pedro wrote:

>Thanks Mark, it works like a charm!
>
>I was puzzled with what you said about the wrapped lines, but when
>testing I saw what you probably meant (one "TypeError: float argument
>required" in the logs); I fixed it by adding "text =
>Utils.to_percent(text)"...so that:
>
>            elif mlist.member_moderation_action == 1:
>                # Reject
>                text = mlist.member_moderation_notice
>                if text:
>                    text = Utils.wrap(text)
>                    d = {'real_name': mlist.real_name,
>                         'web_page_url': mlist.web_page_url,
>                         'cgiext': mm_cfg.CGIEXT,
>                         '_internal_name': mlist.internal_name(),
>                         'options_url': mlist.GetOptionsURL(sender,
>absolute=True),


The line above is what I meant by 'wrapped lines'. I intended it to be

   'options_url': mlist.GetOptionsURL(sender, absolute=True),

but indented  as the others, but since it's inside {} and further the
unintended new line is inside (), it doesn't matter because of
Python's implied continuation.


>                         }
>                    text = text % d
>                    text = Utils.to_percent(text)


I have no idea why the above would fix anything in this context. I
would have to see the traceback from the TypeError to know what's
going on with that, but Utils.to_percent probably doesn't have
anything to do with fixing it.

There is one problem in my original. The

                    text = Utils.wrap(text)

should come after

                    text = text % d

not before so the text is wrapped after the values are interpolated.


>                else:
>                    # Use the default RejectMessage notice string
>                    text = None
>                raise Errors.RejectMessage, text
>
>Possibly you had a better solution in mind for that particular issue,
>this one though seems to work.


What is the traceback from that error?

-- 
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