Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > how to change a factory use of rfc822.Message to mhlib.Message

Reply
Thread Tools

how to change a factory use of rfc822.Message to mhlib.Message

 
 
John Doe
Guest
Posts: n/a
 
      08-27-2004
I've never used a factory and would like to get some help.
The class
mailbox.UnixMailbox has a defination for a factory.

__init__(self, fp, factory=<class rfc822.Message>)

where fp is a file pointer.

I don't want to use rfc822.Message. I'd like to use mhlib.Message instead.

rfc822.Message requires:
__init__(self, fp, seekable=1)

mhlib.Message requires:
__init__(self, f, n, fp=None)

where f think the is a folder name. I've seen '.' used.
(The documentation is very unclear here). And 'n' is the seekable.

How do I call mailbox.UnixMailbox( fp ... ) with mhlib.Message?

Thanks
 
Reply With Quote
 
 
 
 
Steve Holden
Guest
Posts: n/a
 
      08-31-2004
John Doe wrote:

> I've never used a factory and would like to get some help.
> The class
> mailbox.UnixMailbox has a defination for a factory.
>
> __init__(self, fp, factory=<class rfc822.Message>)
>
> where fp is a file pointer.
>
> I don't want to use rfc822.Message. I'd like to use mhlib.Message instead.
>
> rfc822.Message requires:
> __init__(self, fp, seekable=1)
>
> mhlib.Message requires:
> __init__(self, f, n, fp=None)
>
> where f think the is a folder name. I've seen '.' used.
> (The documentation is very unclear here). And 'n' is the seekable.
>
> How do I call mailbox.UnixMailbox( fp ... ) with mhlib.Message?



You'll need to write a "wrapper" class or function around mhlib.Message
to make it look sufficiently similar to rfc822.Message. Then you provide
the wrapper as the factory argument when you create your UnixMailbox.

Clearly the __init__() signature of whatever factory you provide has to
match that of rfc822.Message otherwise you'll get an error when the
mailbox code tries to create a message instance.

regards
Steve
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Abstract factory and Factory pattern C# ASP .Net 4 07-31-2008 03:22 PM
A Paradise DNS address change? What change? There was no change. Tony Neville NZ Computing 7 09-22-2006 01:02 PM
Abstract Factory or Factory Method pattern question.... Medi Montaseri C++ 17 09-03-2003 06:50 AM
Code behind with use of Abstract Factory? Christer ASP .Net 3 08-27-2003 07:20 PM



Advertisments