Added some missing api. references in outlook.py

Added some Dummy Implementations for Outlook Crawler in /testing/winapi.py
Changed outlook.txt accordingly

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2510 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
scrat 2008-04-09 13:46:38 +00:00
parent 3ddcf63821
commit 104d0ac88f
4 changed files with 73 additions and 6 deletions

View file

@ -35,6 +35,12 @@ from twisted.internet.defer import succeed
class Crawler(QueueableAgent):
implements(ICrawler)
params = {}
def __init__(self, master, params={}):
super(Crawler, self).__init__(master)
self.params = params
def process(self):
return self.collect()

View file

@ -23,12 +23,18 @@ $Id$
"""
import re
from email import MIMEMultipart
from zope.interface import implements
from twisted.internet import defer
#import win32com.client
#import ctypes
#import win32api, win32process, win32con
#The watsup import is needed as soon as we start handling the Outlook Pop-Up
#again
#This should also be integrated within the wrapper-api for doctests
#from watsup.winGuiAuto import findTopWindow, findControl, findControls, clickButton, \
# getComboboxItems, selectComboboxItem, setCheckBox
from cybertools.agent.base.agent import Agent, Master
from cybertools.agent.crawl.mail import MailCrawler
@ -63,13 +69,13 @@ class OutlookCrawler(MailCrawler):
self.inbox = criteria.get('inbox') #boolean
self.subfolders = criteria.get('subfolders') #boolean
self.pattern = criteria.get('pattern')
if self.pattern != '':
if self.pattern != '' and self.pattern != None:
self.pattern = re.compile(criteria.get('pattern') or '.*')
def crawlFolders(self):
onMAPI = self.oOutlookApp.GetNamespace("MAPI")
ofInbox = \
onMAPI.GetDefaultFolder(win32com.client.constants.olFolderInbox)
onMAPI.GetDefaultFolder(api.client.constants.olFolderInbox)
# fetch mails from inbox
if self.inbox:
self.loadMailsFromFolder(ofInbox)
@ -92,7 +98,7 @@ class OutlookCrawler(MailCrawler):
folderItems = getattr(folder, 'Items')
for item in range(len(folderItems)):
mail = folderItems.Item(item+1)
if mail.Class == win32com.client.constants.olMail:
if mail.Class == api.win32com.client.constants.olMail:
if self.keys is None:
self.keys = []
for key in mail._prop_map_get_:
@ -116,17 +122,17 @@ class OutlookCrawler(MailCrawler):
"""
hwnd = None
while True:
hwnd = ctypes.windll.user32.FindWindowExA(None, hwnd, None, None)
hwnd = api.ctypes.windll.user32.FindWindowExA(None, hwnd, None, None)
if hwnd == None:
break
else:
val = u"\0" * 1024
ctypes.windll.user32.GetWindowTextW(hwnd, val, len(val))
api.ctypes.windll.user32.GetWindowTextW(hwnd, val, len(val))
val = val.replace(u"\000", u"")
if val and repr(val) == "u'Microsoft Office Outlook'":
print repr(val)
# get the Main Control
form = findTopWindow(wantedText='Microsoft Office Outlook')
form = api.findTopWindow(wantedText='Microsoft Office Outlook')
controls = findControls(form)
# get the check box
checkBox = findControl(form, wantedText='Zugriff')

View file

@ -42,3 +42,4 @@ the twisted reactor first.
>>> from cybertools.agent.tests import tester
>>> tester.iterate()
Outlook.Application retrieved

View file

@ -23,3 +23,57 @@ $Id$
"""
client = ctypes = win32api = win32process = win32con = None
class OutlookFolder(object):
Items = {'mail1': "eMail 1", 'mail2': "eMail2"}
def __init__(self):
pass
class OutlookNamespace(object):
def __init__(self):
pass
def GetDefaultFolder(self, message=""):
print "retrieving Outlook default folder"
folder = OutlookFolder()
return folder
class OutlookApp(object):
def __init__(self):
pass
def GetNamespace(self, message=""):
print "Namespace " + message + " retrieved"
return
class Message(object):
olFolderInbox = None
def __init__(self):
pass
def EnsureDispatch(self, message=""):
print message + " retrieved"
class client(object):
gencache = Message()
constants = Message()
def __init__(self):
pass
class ctypes(object):
def __init__(self):
pass