changed outlook.py: now much more data from the outlook mails is available. Now we also can access the date the mail was sent as well when it has been received. Also data about the attachements is now available (if desired).
Minor change to winapi was necessary in order to support the doctests with the changed outlook api. _prop_map_get now returns a dictionary instead of a tuple. git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2577 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
01b1b5a644
commit
167e914055
2 changed files with 14 additions and 9 deletions
|
@ -110,19 +110,21 @@ class OutlookCrawler(MailCrawler):
|
|||
if mail.Class == api.client.constants.olMail:
|
||||
if self.keys is None:
|
||||
self.keys = []
|
||||
for key in mail._prop_map_get_:
|
||||
for key in mail._prop_map_get_.items():
|
||||
try:
|
||||
if isinstance(getattr(mail, key), (int, str, unicode)):
|
||||
self.keys.append(key)
|
||||
if isinstance(key[0], (int, str, unicode, bool)):
|
||||
self.keys.append(key[0])
|
||||
except api.com_error:
|
||||
pass
|
||||
record = {}
|
||||
for key in self.keys:
|
||||
try:
|
||||
if isinstance(getattr(mail, key), (int, str, unicode, bool)):
|
||||
record[key] = getattr(mail, key)
|
||||
else:
|
||||
record[key] = "Invalid data format"
|
||||
if (hasattr(mail, key)):
|
||||
value = getattr(mail, key)
|
||||
if isinstance(value, (int, str, unicode, bool)):
|
||||
record[key] = value
|
||||
else:
|
||||
record[key] = "Invalid data format"
|
||||
except:
|
||||
record[key] = "Requested attribute not available"
|
||||
# Create the mime email object
|
||||
|
|
|
@ -45,8 +45,11 @@ class Mail(object):
|
|||
def _prop_map_get_(self):
|
||||
#here it is necessary of what attributes (called keys in outlok.py)
|
||||
#an Outlook Mail typically has
|
||||
# should return a tuple ()
|
||||
return ('Subject', 'SenderName', 'To', 'Body')
|
||||
return {'Subject': "Testsubject",\
|
||||
'SenderName': "TestSender",\
|
||||
'To': "TestRecipient",\
|
||||
'Body': "TestBody"
|
||||
}
|
||||
|
||||
|
||||
class Items(object):
|
||||
|
|
Loading…
Add table
Reference in a new issue