Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits:
df96c5f5 by Mark Sapiro at 2020-11-27T15:55:04-08:00
Also add original_size as a message attribute in gatenews.
- - - - -
e4e4ea0d by Mark Sapiro at 2020-11-28T01:04:02+00:00
Merge branch 'osize' into 'master'
Also add original_size as a message attribute in gatenews.
Closes #762
See merge request mailman/mailman!738
- - - - -
3 changed files:
- src/mailman/commands/cli_gatenews.py
- src/mailman/commands/tests/test_cli_gatenews.py
- src/mailman/docs/NEWS.rst
Changes:
=====================================
src/mailman/commands/cli_gatenews.py
=====================================
@@ -105,9 +105,12 @@ def poll_newsgroup(mlist, conn, first, last, glock):
msg['To'] = mlist.posting_address
# Post the message to the list
inq = config.switchboards['in']
+ # original_size is both a message attribute and a key in
+ # msgdata.
+ msg.original_size = len(msg.as_bytes())
inq.enqueue(msg,
listid=mlist.list_id,
- original_size=len(msg.as_bytes()),
+ original_size=msg.original_size,
fromusenet=True)
log.info('posted to list %s: %7d', listname, num)
except nntplib.NNTPError as e:
=====================================
src/mailman/commands/tests/test_cli_gatenews.py
=====================================
@@ -241,10 +241,13 @@ class Test_gatenews(TestCase):
self.assertEqual(lines[3], 'Bad message')
self.assertTrue(lines[4].endswith('[email protected] watermark: 3'))
- def test_original_size_in_msgdata(self):
+ def test_original_size_in_msgdata_and_message(self):
with get_nntplib_nntp():
self._command.invoke(gatenews)
items = get_queue_messages('in', expected_count=1)
msgdata = items[0].msgdata
+ msg = items[0].msg
self.assertTrue(msgdata.get('original_size', False))
self.assertEqual(msgdata['original_size'], 184)
+ self.assertTrue(hasattr(msg, 'original_size'))
+ self.assertEqual(msg.original_size, 184)
=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -21,6 +21,8 @@ Bugs
* Increased the size of the data column in the workflowstate table.
(Closes #793)
* Implemented a ``scrubber`` for plain text digests. (Closes #473)
+* The ``mailman gatenews`` command now adds ``original_size`` as a message
+ attribute. (Extends fix for #762)
New Features
------------
View it on GitLab:
https://gitlab.com/mailman/mailman/-/compare/ab4390b357b7a0107aa1df0486e69627bc656f35...e4e4ea0d062b4def557a4f09967b8a6b4decb227
--
View it on GitLab:
https://gitlab.com/mailman/mailman/-/compare/ab4390b357b7a0107aa1df0486e69627bc656f35...e4e4ea0d062b4def557a4f09967b8a6b4decb227
You're receiving this email because of your account on gitlab.com.
_______________________________________________
Mailman-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: [email protected]