From 97699eede7b36d00a1aa1ceb9fc454764b36d602 Mon Sep 17 00:00:00 2001 From: helmutm Date: Sat, 12 Apr 2008 17:17:50 +0000 Subject: [PATCH] make crawlFolders() a generator by adding yield statements git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2523 fd906abe-77d9-0310-91a1-e0d9ade77398 --- agent/crawl/outlook.py | 4 ++-- agent/crawl/outlook.txt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/agent/crawl/outlook.py b/agent/crawl/outlook.py index 6669a1e..7837f8d 100644 --- a/agent/crawl/outlook.py +++ b/agent/crawl/outlook.py @@ -89,13 +89,13 @@ class OutlookCrawler(MailCrawler): lInboxSubfolders = getattr(ofInbox, 'Folders') for of in range(lInboxSubfolders.__len__()): # get a MAPI-subfolder object and load its emails - self.loadMailsFromFolder(lInboxSubfolders.Item(of + 1)) + yield self.loadMailsFromFolder(lInboxSubfolders.Item(of + 1)) elif self.subfolders and self.pattern: lInboxSubfolders = getattr(ofInbox, 'Folders') for of in range(lInboxSubfolders.__len__()): # get specified MAPI-subfolder object and load its emails if self.pattern.match(getattr(lInboxSubfolders.Item(of + 1), 'Name')): - self.loadMailsFromFolder(lInboxSubfolders.Item(of + 1)) + yield self.loadMailsFromFolder(lInboxSubfolders.Item(of + 1)) def loadMailsFromFolder(self, folder): # get items of the folder diff --git a/agent/crawl/outlook.txt b/agent/crawl/outlook.txt index f6d7e7c..1f45de8 100644 --- a/agent/crawl/outlook.txt +++ b/agent/crawl/outlook.txt @@ -46,3 +46,4 @@ the twisted reactor first. Namespace MAPI retrieved retrieving Outlook default folder collecting Mails from folder + Job 00001 completed; result: [];