[Tracker-discuss] Additional headers

"Martin v. Löwis" martin at v.loewis.de
Mon Jan 7 23:00:56 CET 2008


As a resolution to various issues (140, 169, 143) I'd like to patch
roundup-src to support additional headers. For 169, it would add
an In-reply-to header if there is none, but the message is not the
first message; that header would point to the msgid of the first
message.

For the other two, I would like to add a set of headers, generated
automatically for all link/multilink properties pointing to a class
with a name property; the header value would be the comma-separated
list of the propery values (for multilink, or a single value otherwise -
no header if the link is None). As a consequence, an email may include

X-Roundup-issue-status: pending
X-Roundup-issue-files: passwd, mime.types
X-Roundup-issue-type: behavior
X-Roundup-issue-severity: normal
X-Roundup-issue-versions: Python 2.6, Python 2.4
X-Roundup-issue-priority: urgent
X-Roundup-issue-keywords: patch

(notice the absence of X-Roundup-issue-resolution, which was not set for
this issue, and X-Roundup-issue-nosy, which doesn't meet the
specification - the target of the nosy links has no 'name' property,
but only 'username')

People could then configure their local email filters based on these
headers.

What I'd like to find out with this email is:
- is this mechanism desirable, even though it might add a significant
  payload to the email header (say, 7 out 30 headers)?
- does the implementation look correct?
- any other concerns?

Regards,
Martin

Index: roundupdb.py
===================================================================
--- roundupdb.py        (Revision 59203)
+++ roundupdb.py        (Arbeitskopie)
@@ -395,6 +395,39 @@
             if inreplyto:
                 writer.addheader('In-Reply-To', inreplyto)

+            # Additional headers for bugs.python.org
+            # 20080106 mvl
+
+            # Generate a header for each link or multilink to
+            # a class that has a name attribute
+            for propname, prop in self.getprops().items():
+                if not isinstance(prop, (hyperdb.Link, hyperdb.Multilink)):
+                    continue
+                cl = self.db.getclass(prop.classname)
+                if not 'name' in cl.getprops():
+                    continue
+                if isinstance(prop, hyperdb.Link):
+                    value = self.get(nodeid, propname)
+                    if value is None:
+                        continue
+                    values = [value]
+                else:
+                    values = self.get(nodeid, propname)
+                    if not values:
+                        continue
+                values = [cl.get(v, 'name') for v in values]
+                values = ', '.join(values)
+                writer.addheader("X-Roundup-%s-%s" % (self.classname,
propname),
+                                 values)
+            if not inreplyto:
+                # Default the reply to the first message
+                msgs = self.get(nodeid, 'messages')
+                # Assume messages are sorted by increasing message
number here
+                if msgs[0] != nodeid:
+                    inreplyto = messages.get(msgs[0], 'messageid')
+                    writer.addheader('In-Reply-To', inreplyto)
+            # end additional headers
+
             # attach files
             if message_files:
                 part = writer.startmultipartbody('mixed')


More information about the Tracker-discuss mailing list