[RFC] An EmailMessage class for bzrlib

Adeodato Simó dato at net.com.org.es
Wed Jun 20 18:21:13 BST 2007


* Aaron Bentley [Wed, 20 Jun 2007 12:31:41 -0400]:

> Adeodato Simó wrote:
> >     @staticmethod
> >     def _basestring_to_unicode(string):
> >         """Return an unicode object for string.

> >         If string is a non-ASCII byte string, NonAsciiString will be raised.
> >         """

> This looks like a potential companion to osutils.safe_unicode.  Does
> anyone know if we're following this pattern elsewhere?

FWIW, I can't find any similar uses with grep.

> Maybe it's simpler to just use safe_unicode?

Hm, I'm divided about this. I'll try to get my mind decided about it,
though.

> Well, it's just a bit strange to advertise it as "text", yet accept
> arbitrary binary data.  As "add_attachment", it would make sense to me.

Well, this use comes from the original SMTPConnection, and I agree with
it. The name of the function and the docstring implies that it's only
intended for stuff to be displayed as text -- which I think it's the
most common use case in Bazaar.

> I wasn't proposing changing the constructor.  I was proposing a static
> method:

Aah, you're right, I misread. I will add that, sure.

> > What would be missing?

> I think there might be situations where you'd want to have multiple
> attachments,

That's possible: you can call add_text_atachment multiple times. :-)

> or specify attachment MIME type.

I know of no current use case for this, so I'd rather delay further
additions to the API (eg. .add_attachment(data, filename, type)) until
it becomes necessary.

Thanks,

-- 
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
So!, So. First day, Yes. Scary, Yes. Don't be scared, Well I'm not really
scared. You should be, Well I am a little bit scared. Well don't be, Make up
your mind!
                -- Denholm, Jen. The IT Crowd.




More information about the bazaar mailing list