Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
c21ea4c9 by Mark Sapiro at 2021-04-10T23:35:06-07:00
Defend against a database anomaly in cli_notify.py.

- - - - -
2b05e844 by Mark Sapiro at 2021-04-11T07:02:41+00:00
Merge branch 'notify' into 'master'

Defend against a database anomaly in cli_notify.py.

See merge request mailman/mailman!824
- - - - -


2 changed files:

- src/mailman/commands/cli_notify.py
- src/mailman/docs/NEWS.rst


Changes:

=====================================
src/mailman/commands/cli_notify.py
=====================================
@@ -116,14 +116,18 @@ def _build_detail(requestdb, subs, unsubs):
     if requestdb.count_of(RequestType.held_message) > 0:
         detail += _('\nHeld Messages:\n')
         for rq in requestdb.of_type(RequestType.held_message):
-            key, data = requestdb.get_request(rq.id)
-            sender = data['_mod_sender']
-            subject = data['_mod_subject']
-            reason = data['_mod_reason']
-            detail += '    ' + _('Sender: {}\n').format(sender)
-            detail += '    ' + _('Subject: {}\n').format(
-                str(make_header(decode_header(subject))))
-            detail += '    ' + _('Reason: {}\n\n').format(reason)
+            if requestdb.get_request(rq.id):
+                key, data = requestdb.get_request(rq.id)
+                sender = data['_mod_sender']
+                subject = data['_mod_subject']
+                reason = data['_mod_reason']
+                detail += '    ' + _('Sender: {}\n').format(sender)
+                detail += '    ' + _('Subject: {}\n').format(
+                    str(make_header(decode_header(subject))))
+                detail += '    ' + _('Reason: {}\n\n').format(reason)
+            else:
+                detail += '    ' + _(                    # pragma: nocover
+                    'Missing data for request {}\n\n').format(rq.id)
     return detail
 
 


=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -28,6 +28,11 @@ Bugs
 * Handling a held message now also removes the poster's pending
   ``held message`` from the pending db.  (Closes #257)
 
+Command line
+------------
+* The ``notify`` subcommand is no more tolerant of certain database anomalies.
+  (Closes #861)
+
 REST
 ----
 * Fixed an exception on retreiving held messages if the held request exists,



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/c7dd59c00daa1b742a59ed38b876b7c5c7067f39...2b05e8441265ae5edb14a5896c45f4c20213df69

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/c7dd59c00daa1b742a59ed38b876b7c5c7067f39...2b05e8441265ae5edb14a5896c45f4c20213df69
You're receiving this email because of your account on gitlab.com.


_______________________________________________
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org

Reply via email to