diff --git a/agent/crawl/outlook.py b/agent/crawl/outlook.py index 57f605b..95086ea 100644 --- a/agent/crawl/outlook.py +++ b/agent/crawl/outlook.py @@ -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 diff --git a/agent/testing/winapi.py b/agent/testing/winapi.py index d44b947..51eeb92 100644 --- a/agent/testing/winapi.py +++ b/agent/testing/winapi.py @@ -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):