Jason R. Mastaler wrote:

> Jesse Guardiani <[EMAIL PROTECTED]> writes:
> 
>>> Still, I'm sure if you manage to write something solid that avoids
>>> the problems people have mentioned Jason would probably take a good
>>> look at it.
>>
>> That's what I'm counting on. In my experience, programmers rarely
>> refuse free code.
> 
> Of course, if you want this in TMDA, it'll have to wait until after
> 1.0 is released since it's a new feature.

I really hope you can find it in your heart to reconsider that statement.
I consider it more of a bug fix anyway.

I got this "new feature" working with my custom python script
last night on my laptop. I only had to change 3 lines of code.

Apparently the python email module (from the TMDA distrib) ships with
support for this "feature" right out of the box! Since my custom python
script is about 90% pure TMDA code, you should recognize the following
without much trouble. All you have to do is this:

  msgin = msg_from_file(sys.stdin)

instead of:

  stdin = StringIO(sys.stdin.read())
  msgin = msg_from_file(stdin)

And change the return statement in msg_from_file() from this:

  return HeaderParser(Message, strict=strict).parse(fp)

To this:

  return HeaderParser(Message, strict=strict).parse(fp, headersonly=True)

And figure out how to print the body of the message to disk/stdout without
using the email module. Instead of this:

  print msg_as_string(msgin)

I do this:

  # Print headers
  print msg_as_string(msgin)
  # Print body
  print sys.stdin.read()



It turns out to be pretty darn simple, really. The 'headersonly=True' is
the key in the HeaderParser.parse() method.

I plan to release some performance and memory benchmarks in a few hours.
Hopefully I'll have a full patch for TMDA later today, tommorrow, or Monday.
(Depending on my schedule, of course)


-- 
Jesse Guardiani, Systems Administrator
WingNET Internet Services,
P.O. Box 2605 // Cleveland, TN 37320-2605
423-559-LINK (v)  423-559-5145 (f)
http://www.wingnet.net


_________________________________________________
tmda-workers mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-workers

Reply via email to