[Zope3-checkins] CVS: Products3/z3checkins - interfaces.py:1.8
message.pt:1.8 message.py:1.26 rss_message.pt:1.3
Gintautas Miliauskas
gintas at pov.lt
Tue Feb 10 12:51:44 EST 2004
Update of /cvs-repository/Products3/z3checkins
In directory cvs.zope.org:/tmp/cvs-serv3262
Modified Files:
interfaces.py message.pt message.py rss_message.pt
Log Message:
* Removed obsolete 'author' attribute from messages.
* Subject and creation date is now stored in Dublin Core as well.
* Modified message.py to barf on invalid messages.
=== Products3/z3checkins/interfaces.py 1.7 => 1.8 ===
--- Products3/z3checkins/interfaces.py:1.7 Tue Jan 13 12:08:54 2004
+++ Products3/z3checkins/interfaces.py Tue Feb 10 12:51:14 2004
@@ -15,7 +15,6 @@
"""Mail message."""
message_id = Attribute("Unique message ID")
- author = Attribute("Author's name and email address in RFC822 format")
author_name = Attribute("Author's real name")
author_email = Attribute("Author's email address")
subject = Attribute("Subject line of the message")
=== Products3/z3checkins/message.pt 1.7 => 1.8 ===
--- Products3/z3checkins/message.pt:1.7 Wed Sep 17 10:12:50 2003
+++ Products3/z3checkins/message.pt Tue Feb 10 12:51:14 2004
@@ -40,7 +40,10 @@
class="icon" src="++resource++branch.png" alt="Branch"
tal:attributes="title string:Branch: ${context/branch}"/>
<div class="headers">
-<p><span class="header">From:</span> <span class="value" tal:content="context/author" /></p>
+<p><span class="header">From:</span>
+ <span class="value" tal:content="context/author_name" />
+ <<span class="value" tal:content="context/author_email" />>
+</p>
<p><span class="header">Date:</span> <span class="value" tal:content="context/date/@@rfc822" /></p>
<p><span class="header">Subject:</span> <span class="value" tal:content="context/subject" /></p>
</div>
=== Products3/z3checkins/message.py 1.25 => 1.26 ===
--- Products3/z3checkins/message.py:1.25 Tue Feb 10 11:20:28 2004
+++ Products3/z3checkins/message.py Tue Feb 10 12:51:14 2004
@@ -124,11 +124,10 @@
__parent__ = __name__ = None
- def __init__(self, message_id=None, author=None, author_name=None,
+ def __init__(self, message_id=None, author_name=None,
author_email=None, subject=None, date=None,
full_text=None):
self.message_id = message_id
- self.author = author
self.author_name = author_name
self.author_email = author_email
self.subject = subject
@@ -158,11 +157,11 @@
implements(ICheckinMessage)
- def __init__(self, message_id=None, author=None, author_name=None,
+ def __init__(self, message_id=None, author_name=None,
author_email=None, subject=None, date=None, full_text=None,
directory=None, log_message=None, branch=None):
super(CheckinMessage, self).__init__(message_id=message_id,
- author=author, author_name=author_name, author_email=author_email,
+ author_name=author_name, author_email=author_email,
subject=subject, date=date, full_text=full_text)
self.directory = directory
self.log_message = log_message
@@ -187,12 +186,16 @@
input = StringIO(full_text)
m = rfc822.Message(input)
- subject = m.getheader('Subject').replace('\n', '')
+ subject = m.getheader('Subject') or ''
+ subject = subject.replace('\n', '')
message_id = m.getheader('Message-Id')
+ if message_id is None:
+ raise FormatError("Message does not have a message id")
if message_id[0] == "<" and message_id[-1] == ">":
message_id = message_id[1:-1]
author = m.getheader('From')
author_name, author_email = m.getaddr('From')
+
date = m.getheader('Date')
# Fix incorrect timezones (+XX:XX instead of RFC-822 mandated +XXXX)
@@ -231,7 +234,7 @@
# this might throw a FormatError on its own as well
log_message, branch = self.extract_log(body_lines)
return CheckinMessage(
- message_id=message_id, author=author,
+ message_id=message_id,
author_name=author_name,
author_email=author_email, subject=subject,
date=date, full_text=full_text,
@@ -242,7 +245,7 @@
# fall back to adding a simple message
pass
- return Message(message_id=message_id, author=author,
+ return Message(message_id=message_id,
author_name=author_name,
author_email=author_email, subject=subject,
date=date, full_text=full_text)
@@ -333,9 +336,13 @@
for message in messages:
try:
self.add(message)
+ dc = queryAdapter(message, IZopeDublinCore)
+ if dc is not None:
+ # XXX should handle RFC-2047
+ dc.title = unicode(message.subject)
+ dc.created = message.date
except DuplicationError:
- # leave the old mesage unchanged if a duplicate is found
- pass
+ pass # leave the old mesage unchanged if a duplicate is found
else:
message = parser.parse(msg_raw)
self.add(message)
=== Products3/z3checkins/rss_message.pt 1.2 => 1.3 ===
--- Products3/z3checkins/rss_message.pt:1.2 Fri Aug 1 05:43:16 2003
+++ Products3/z3checkins/rss_message.pt Tue Feb 10 12:51:14 2004
@@ -3,6 +3,6 @@
<link tal:content="context/@@absolute_url" />
<description tal:content="context/log_message | nothing" />
<guid tal:content="context/@@absolute_url" />
- <author tal:content="context/author" />
+ <author><tal:block tal:replace="context/author_name" /> <<tal:block tal:replace="context/author_email" />></author>
<pubDate tal:content="context/date/@@rfc822" />
</item>
More information about the Zope3-Checkins
mailing list