[Mailman-Developers] Uncaught runner exception: 'generator' object has no attribute 'insert'

Pavel Chytil paja@asp.ogi.edu
Mon, 26 Nov 2001 23:28:31 -0800


Barry,

still not there, same approache like last try:

Nov 26 23:25:30 2001 (15396) Uncaught runner exception: unsubscriptable object
Nov 26 23:25:30 2001 (15396) Traceback (most recent call last):
  File "/work/mailman/Mailman/Queue/Runner.py", line 104, in __oneloop
    self.__onefile(msg, msgdata)
  File "/work/mailman/Mailman/Queue/Runner.py", line 152, in __onefile
    keepqueued = self._dispose(mlist, msg, msgdata)
  File "/work/mailman/Mailman/Queue/CommandRunner.py", line 61, in _dispose
    mlist.ParseMailCommands(msg, msgdata)
  File "/work/mailman/Mailman/MailCommandHandler.py", line 184, in
ParseMailCommands
    lines = email.Iterators.body_line_iterator(msg)[:]
TypeError: unsubscriptable object

Thanks,
	Pavel

Cituji z emailu od "Barry A. Warsaw" <barry@zope.com>:

> 
> Oops.  Okay, let's try this one!
> 
> -Barry
> 
> Index: MailCommandHandler.py
> ===================================================================
> RCS file: /cvsroot/mailman/mailman/Mailman/MailCommandHandler.py,v
> retrieving revision 2.25
> diff -u -r2.25 MailCommandHandler.py
> --- MailCommandHandler.py	2001/11/27 04:26:25	2.25
> +++ MailCommandHandler.py	2001/11/27 07:20:00
> @@ -181,7 +181,12 @@
>              if mo:
>                  subject = mo.group('cmd')
>  
> -        lines = email.Iterators.body_line_iterator(msg)[:]
> +        # We must have a real list because of the way we insert an element
> and
> +        # iterate over it.  In email 0.x (pre-Python 2.2)
> body_line_iterator()
> +        # returns a real list, but in email 1.x (Python 2.2), it returns a
> +        # generator.  This is the only way to coerce it to a concrete list
> +        # object in both cases.
> +        lines = list(email.Iterators.body_line_iterator(msg))
>  
>          # Find out if the subject line has a command on it
>          subjcmd = []
> 
>