[Zope3-checkins] CVS: Products3/z3checkins - message.py:1.37
Gintautas Miliauskas
gintas at pov.lt
Fri Mar 26 17:18:39 EST 2004
Update of /cvs-repository/Products3/z3checkins
In directory cvs.zope.org:/tmp/cvs-serv1401
Modified Files:
message.py
Log Message:
Fixed a bug where checkins would barf when no file was specified.
=== Products3/z3checkins/message.py 1.36 => 1.37 ===
--- Products3/z3checkins/message.py:1.36 Fri Mar 26 17:11:47 2004
+++ Products3/z3checkins/message.py Fri Mar 26 17:18:08 2004
@@ -340,25 +340,27 @@
data_widget = CustomWidgetFactory(FileWidget)
def createAndAdd(self, data):
- msg_raw = data['data']
- parser = getUtility(self.context, IMessageParser)
- if msg_raw.startswith("From "):
- # detected an mbox file
- mbox = StringIO(msg_raw)
- messages = mailbox.PortableUnixMailbox(mbox, factory=parser.parse)
- 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:
- pass # leave the old mesage unchanged if a duplicate is found
- else:
- message = parser.parse(msg_raw)
- self.add(message)
+ if data.has_key('data'): # XXX should we bark if no data is given?
+ msg_raw = data['data']
+ parser = getUtility(self.context, IMessageParser)
+ if msg_raw.startswith("From "):
+ # detected an mbox file
+ mbox = StringIO(msg_raw)
+ messages = mailbox.PortableUnixMailbox(mbox,
+ factory=parser.parse)
+ 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:
+ pass # leave the old mesage unchanged
+ else:
+ message = parser.parse(msg_raw)
+ self.add(message)
class ContainerView:
More information about the Zope3-Checkins
mailing list