From: Andy T. <an...@us...> - 2005-12-13 11:14:09
|
Update of /cvsroot/pythoncard/PythonCard/samples/addresses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/addresses Modified Files: addresses.py outlook.py Log Message: Removed all of the plain except: clauses I could Index: outlook.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/addresses/outlook.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** outlook.py 6 Jan 2003 21:13:25 -0000 1.5 --- outlook.py 13 Dec 2005 11:13:21 -0000 1.6 *************** *** 1,12 **** ! """ - __version__ = "$Revision$" - __date__ = "$Date$" - I need a more generic way of dealing with these modules that may not be available. Also, if the MSOutlook __init__ can't be completed, what's an appropriate failure mechanism? - """ try: --- 1,10 ---- ! #!/usr/bin/python """ I need a more generic way of dealing with these modules that may not be available. Also, if the MSOutlook __init__ can't be completed, what's an appropriate failure mechanism? """ + __version__ = "$Revision$" + __date__ = "$Date$" try: *************** *** 18,22 **** WIN32_FOUND = 1 ! except: WIN32_FOUND = 0 --- 16,20 ---- WIN32_FOUND = 1 ! except ImportError: WIN32_FOUND = 0 *************** *** 27,31 **** def __init__(self): self.outlookFound = 0 ! try: #oOutlookApp = win32com.client.Dispatch("Outlook.Application.9") #self.oOutlookApp = win32com.client.Dispatch("Outlook.Application") --- 25,29 ---- def __init__(self): self.outlookFound = 0 ! if WIN32_FOUND: #oOutlookApp = win32com.client.Dispatch("Outlook.Application.9") #self.oOutlookApp = win32com.client.Dispatch("Outlook.Application") *************** *** 34,41 **** self.oOutlookApp = win32com.client.gencache.EnsureDispatch("Outlook.Application") self.outlookFound = 1 ! except: #print "unable to load Outlook" pass - self.olFolderInbox = 6 self.olContactItem = 2 --- 32,38 ---- self.oOutlookApp = win32com.client.gencache.EnsureDispatch("Outlook.Application") self.outlookFound = 1 ! else: #print "unable to load Outlook" pass self.olFolderInbox = 6 self.olContactItem = 2 *************** *** 45,62 **** self.olMinimized = 1 self.olNormalWindow = 2 - self.records = [] - def loadRecords(self): if not self.outlookFound: return - # this should use more try/except blocks or nested blocks onMAPI = self.oOutlookApp.GetNamespace("MAPI") ofContacts = onMAPI.GetDefaultFolder(self.olFolderContacts) - #print "number of contacts:", len(ofContacts.Items) - for oc in range(len(ofContacts.Items)): contact = ofContacts.Items.Item(oc + 1) --- 42,54 ---- *************** *** 74,80 **** record['Email1Address'] = contact.Email1Address record['Body'] = contact.Body - self.records.append(record) - #print "InterfaceCount/GatewayCount %d/%d" % (pythoncom._GetInterfaceCount(), pythoncom._GetGatewayCount()) --- 66,70 ---- Index: addresses.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/addresses/addresses.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** addresses.py 12 Aug 2004 19:18:47 -0000 1.35 --- addresses.py 13 Dec 2005 11:13:21 -0000 1.36 *************** *** 2,8 **** """ - __version__ = "$Revision$" - __date__ = "$Date$" - A lot of the record structure and logic mirrors Winkler's approach used in the textIndexer, but I coded this from scratch to see what kind of differences --- 2,5 ---- *************** *** 12,17 **** addresses sample to test different approaches to storage formats: ZODB, mySQL, plain text files using lists and dictionaries, CSV text files, etc. - """ from PythonCard import configuration, dialog, model, util --- 9,15 ---- addresses sample to test different approaches to storage formats: ZODB, mySQL, plain text files using lists and dictionaries, CSV text files, etc. """ + __version__ = "$Revision$" + __date__ = "$Date$" from PythonCard import configuration, dialog, model, util *************** *** 47,51 **** self.openFile(filename) - """ This should probably be a list supplied as part of initialization. --- 45,48 ---- *************** *** 137,142 **** return - - def newRecord(self): self.saveRecord(self.current) --- 134,137 ---- *************** *** 192,196 **** if self.current == -1 and len(self.records) > 0: self.displayRecord(0) ! except: pass --- 187,191 ---- if self.current == -1 and len(self.records) > 0: self.displayRecord(0) ! except IOError: pass *************** *** 203,211 **** pprint.pprint(self.records, f) f.close() ! except: pass - - class Addresses(model.Background): --- 198,204 ---- pprint.pprint(self.records, f) f.close() ! except IOError: pass class Addresses(model.Background): *************** *** 233,237 **** event.skip() - def on_fileImportOutlook_command(self, event): addressesToOutlookMap = {'Name':'FullName', --- 226,229 ---- *************** *** 328,335 **** else: ins = widget.getInsertionPoint() ! try: ! widget.replace(ins, ins + 1, '') ! except: ! pass def on_editSelectAll_command(self, event): --- 320,324 ---- else: ins = widget.getInsertionPoint() ! widget.replace(ins, ins + 1, '') def on_editSelectAll_command(self, event): *************** *** 353,358 **** target.label = 'Show Notes' - - if __name__ == '__main__': app = model.Application(Addresses) --- 342,345 ---- |