[Mailman-Users] Disappearing message
Mark Sapiro
msapiro at value.net
Fri Oct 26 23:40:43 CEST 2007
Anne Ramey wrote:
><snip>
>> Way 2 is to modify scripts/post to log something. At the end of the
>> main() function following:
>>
>> inq = get_switchboard(mm_cfg.INQUEUE_DIR)
>> inq.enqueue(sys.stdin.read(),
>> listname=listname,
>> tolist=1, _plaintext=1)
>>
>> add
>>
>> print >> sys.stderr, _('post to %(listname)s received and queued')
>>
>>
>> This will write the 'post to %(listname)s received and queued' message
>> with the listname filled in to both the error and post logs for every
>> post. This again will tell you if the post got to the post script.
>>
>>
><snip>
>
>OK, I added this code, but I get this:
>Oct 26 16:18:41 2007 post(17996): post to %(listname)s received and queued
>in the error log (it doesn't replace the listname with the variable) and
>nothing in the post log. Did I do something wrong?
Nothing in the post log is correct. I forgot what the
LogStdErr("error", "post") call in the script does. I thought the
second argument was a second log, but it's the identifying label.
The non-replacement of %(listname)s with the name is puzzling. The i18n
_() function should do this replacement. I copied the print directly
from below and it worked for me. However, you could do the
interpolation directly as in
print >> sys.stderr, 'post to %s received and queued' % listname
and that should work.
>def main():
> # TBD: If you've configured your list or aliases so poorly as to get
> # either of these first two errors, there's little that can be done to
> # save your messages. They will be lost. Minimal testing of new lists
> # should avoid either of these problems.
> try:
> listname = sys.argv[1]
> except IndexError:
> print >> sys.stderr, _('post script got no listname.')
> sys.exit(1)
> # Make sure the list exists
> if not Utils.list_exists(listname):
> print >> sys.stderr, _('post script, list not found: %(listname)s')
> sys.exit(1)
> # Immediately queue the message for the incoming qrunner to
>process. The
> # advantage to this approach is that messages should never get lost --
> # some MTAs have a hard limit to the time a filter prog can run.
>Postfix
> # is a good example; if the limit is hit, the proc is SIGKILL'd
>giving us
> # no chance to save the message.
> inq = get_switchboard(mm_cfg.INQUEUE_DIR)
> inq.enqueue(sys.stdin.read(),
> listname=listname,
> tolist=1, _plaintext=1)
> print >> sys.stderr, _('post to %(listname)s received and queued')
>
--
Mark Sapiro <msapiro at value.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