[Python-checkins] r59861 - tracker/roundup-src/roundup/roundupdb.py
martin.v.loewis
python-checkins at python.org
Tue Jan 8 20:54:25 CET 2008
Author: martin.v.loewis
Date: Tue Jan 8 20:54:24 2008
New Revision: 59861
Modified:
tracker/roundup-src/roundup/roundupdb.py
Log:
Generate additional headers.
Modified: tracker/roundup-src/roundup/roundupdb.py
==============================================================================
--- tracker/roundup-src/roundup/roundupdb.py (original)
+++ tracker/roundup-src/roundup/roundupdb.py Tue Jan 8 20:54:24 2008
@@ -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 Python-checkins
mailing list