[Erp5-report] r21569 - in /erp5/trunk/products/ERP5: Document/ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Jun 13 11:37:40 CEST 2008
Author: jerome
Date: Fri Jun 13 11:37:36 2008
New Revision: 21569
URL: http://svn.erp5.org?rev=21569&view=rev
Log:
make title_or_id work for ingested email documents.
(also fix docstrings for EmailDocument.getTitle and EmailDocument.getStartDate)
Modified:
erp5/trunk/products/ERP5/Document/EmailDocument.py
erp5/trunk/products/ERP5/tests/testCRM.py
Modified: erp5/trunk/products/ERP5/Document/EmailDocument.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/EmailDocument.py?rev=21569&r1=21568&r2=21569&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/EmailDocument.py (original)
+++ erp5/trunk/products/ERP5/Document/EmailDocument.py Fri Jun 13 11:37:36 2008
@@ -215,7 +215,7 @@
security.declareProtected(Permissions.AccessContentsInformation, 'getTitle')
def getTitle(self, default=_MARKER):
"""
- Returns the title
+ Returns the title from the mail subject
"""
if not self.hasFile():
# Return the standard text content if no file was provided
@@ -224,11 +224,16 @@
else:
return self._baseGetTitle(default)
return self.getContentInformation().get('Subject', '')
+
+ def title_or_id(self):
+ """Return the title if it is not blank and the id otherwise.
+ """
+ return self.getTitleOrId()
security.declareProtected(Permissions.AccessContentsInformation, 'getStartDate')
def getStartDate(self, default=_MARKER):
"""
- Returns the title
+ Returns the date from the mail date
"""
if not self.hasFile():
# Return the standard start date if no file was provided
Modified: erp5/trunk/products/ERP5/tests/testCRM.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testCRM.py?rev=21569&r1=21568&r2=21569&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testCRM.py (original)
+++ erp5/trunk/products/ERP5/tests/testCRM.py Fri Jun 13 11:37:36 2008
@@ -370,6 +370,8 @@
# tite is found automatically, based on the Subject: header in the mail
event = self._ingestMail('simple')
self.assertEquals('Simple Mail Test', event.getTitle())
+ self.assertEquals('Simple Mail Test', event.getTitleOrId())
+ self.assertEquals('Simple Mail Test', event.title_or_id())
def test_asText(self):
# asText requires portal_transforms
More information about the Erp5-report
mailing list