diff roundup/mailgw.py @ 8557:f80c566f5726

feat: improve store_trace_reason with extract parameter store_trace_reason() used embedded code to extract reason based on the location passed to the function. This change adds support for extract keyword that is a Python expression eval'ed when the underlying function/method is called. All callers now set the extract parameter. The prior embedded code has been removed from store_trace_reason(). Failure to eval the expression results in an roundup.logcontext error severity log. Also updated docs. Also replaced env['REQUEST_URI'] with env['PATH_INFO'] for web based entry points as REQUEST_URI isn't documented as a required key and some other front end (e.g. zope, cgi) might not supply this.
author John Rouillard <rouilj@ieee.org>
date Mon, 06 Apr 2026 22:10:23 -0400
parents 14c7c07b32d8
children 9c3ec0a5c7fc
line wrap: on
line diff
--- a/roundup/mailgw.py	Mon Apr 06 01:30:55 2026 -0400
+++ b/roundup/mailgw.py	Mon Apr 06 22:10:23 2026 -0400
@@ -1648,7 +1648,9 @@
                                                             RoundupMessage))
 
     @gen_trace_id()
-    @store_trace_reason("mailgw")
+    @store_trace_reason("mailgw",
+                    extract="args[1].get_header('message-id', 'no_message_id')"
+    )
     def handle_Message(self, message):
         """Handle an RFC822 Message
 

Roundup Issue Tracker: http://roundup-tracker.org/