New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional multipart/mixed digest format. #221
Conversation
Would this be more palatable as an option and/or as a straight one-part message? The problem with a default-off option is that digest will still be practically useless by default. The problem with one-part message format is it'll be even less compatible with existing postproc filters. |
I like the idea of a utility boost, but I hesitate to accept backwards-incompatible changes without a mandate. This leads me to think that this project needs to prepare for a major version update, where changes such as this and others like #216 can be accepted without hesitance. Another way to go about it is to develop a |
I posted such a digest-post-process in the discussion: #194 (comment). It preserves the nesting level with an additional multipart/mixed wrapping. Though it seems wrong, as a permanent solution, to force the user to resort to a postprocessor (even a well-documented one). I'm willing to make the built-in feature optional and default off. (Mostly, I can't come up with a good name for that config option. "multipart-mixed-digest" sounds so lame.) This seems to be a good compromise. There is no incompatibility, because if a user sets that option, then they are aware that any digest-post-process filter they write has to handle the multipart/mixed format. As a separate issue, is single-part digest better then multipart/mixed? It's cleaner, but lacks the structure that can help guide postproc filters. |
Yesterday I read a report about an interview with Linus Torvalds. The following quote reminded me of this discussion:
I completely agree with the sentiment, that your old setup should just work, following an upgrade.
True, it may be fine from the user’s perspective, but think about it from a software maintainability standpoint. I do not want One way to work around the naming issue is to leave the option name as
I don’t think any format is better than the other. So long as we keep a multipart default, users may postprocess further to their liking. A single-part digest is yet another example filter that we can provide and document. |
I do agree with the sentiment. I wouldn't have suggested breaking compatibility except that I don't think anybody is really using digests. I also like keeping the It's not all that straightforward to flatten a multipart/mixed message after the fact, because each part is a full html document, but it can be done. |
Oh yeah, anyway, I'll give it a go. |
OK. After looking at the code and thinking about it, I think it much better to have a separate config option "digest-type" that defaults "multipart/digest". It's conceptually unclean to mix boolean and string values (even as a compatibility kludge) and the code really doesn't like to do it. |
OK sorry I made the mistake of pulling from before making this change. So, if it's better I can trash this one, make a clean branch, and submit a new pull request with a clean, single commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the mistake of pulling from before making this change. So, if it's better I can trash this one, make a clean branch, and submit a new pull request with a clean, single commit.
For a more complex change, that requires multiple commits to provide context for each stage of refactoring, I would have demanded a clean rebase. For this one, I would simply use the Squash and merge
button, which is effectively going to create that single commit for you (us) automatically.
Thanks! The commit message will be pretty ugly and hard to follow, with "change digest format..." followed by "revert ...", with merges from master in the middle. But I guess I'm okay with that. There isn't a way for me to do the squash and edit the commit message, is there? |
Oh yeah, I noticed I have a typo in a comment, two slashes: multipart//mixed. |
b1c5975
to
632691b
Compare
I fixed the typo, removed a pair of redundant parentheses, and added an entry to the CHANGELOG. diff --git a/CHANGELOG b/CHANGELOG
index 2dbcf78..c245546 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,5 @@
UNRELEASED
+ * New `digest-type` configuration adds optional more widely supported `multipart/mixed` format
* New argument `--only-new` on the `add` command to ignore entries in feed
when added, so only new entries will be sent.
* Fix crash on html-mail entries with no URL
diff --git a/rss2email/feed.py b/rss2email/feed.py
index b4d62d4..df21d85 100644
--- a/rss2email/feed.py
+++ b/rss2email/feed.py
@@ -1005,12 +1005,12 @@ class Feed (object):
return digest
def _append_to_digest(self, digest, message):
- if (self.digest_type == 'multipart/digest'):
+ if self.digest_type == 'multipart/digest':
part = _MIMEMessage(message)
part.add_header('Content-Disposition', 'attachment')
digest.attach(part)
else:
- # multipart//mixed
+ # multipart/mixed
digest.attach(message)
def _send_digest(self, digest, sender): |
Thank you! Yeah, I tried to write that conditional in C there. |
Thanks, @squeakbat! Amir (usually yxejamir in #rss2email on libera.chat) |
Thank you all for the help! |
The previous format (multipart/digest), was incompatible with many
popular e-mail readers (such as gmail), which made it essentially
unusable.
The new format is multipart/mixed, with each part consisting
of a single non-digest message (of type text/plain or text/html).
One possible incorrectness is that the parts still retain message
headers (subject, date, etc.) that are not really used by normal text
attachments.
This is an incompatible change. It looks different, and may break
existing digest-post-proc functions.