[Email-SIG] patch to the email package?
Tim Hicks
tim at sitefusion.co.uk
Tue Jul 5 01:33:18 CEST 2005
Hi Barry (and the email-sig),
I wrote to you (and the email-sig) a couple of times around the New Year
about my attempts to persist email.Message.Message -derived instances in
the ZODB.
After a bit of a break from what I was up to, I need this again. A little
more experimentation with the version 3.0 release and it seems like you
have solved most of my issues :-).
So far, the only problem I face is that Message.get_payload returns a list
that is a reference to the actual payload i.e. in-place mutations of the
list should affect the actual Message object. However, this doesn't play
nicely with ZODB as lists don't automatically persist without _p_changed =
1 being set.
I'd like to adjust set_payload so that it ensures that only PersistentList
instances get stored as self._payload (by constructing one from the
incoming standard list if necessary *). However, this causes a real
problem because there is code all over the place that does:
isinstance(self._payload, list)
... which fails if self._payload is a (UserList-inheriting) PersistentList.
So, my question is this: would you accept a patch that changes all code like:
isinstance(self._payload, list)
to:
isinstance(self._payload, (list, UserList) )
?
Cheers,
Tim
* I suppose this would be a source of potentially unexpected behaviour if
users were used to being able to construct a list, add it as a Message
payload, and then go on mutating it without fetching it out of the Message
object again. Ah well, I think I can live with that.
More information about the Email-SIG
mailing list