Update of /cvsroot/pywin32/pywin32/com/win32comext/mapi
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3167/com/win32comext/mapi
Modified Files:
mapiutil.py
Log Message:
move to dict iterators and modern type checking
Index: mapiutil.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/mapi/mapiutil.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** mapiutil.py 27 Nov 2008 03:53:25 -0000 1.8
--- mapiutil.py 4 Dec 2008 07:07:04 -0000 1.9
***************
*** 4,9 ****
ListType=list
IntType=int
! StringType=str
! from pywintypes import UnicodeType, TimeType
import pythoncom
import mapi, mapitags
--- 4,8 ----
ListType=list
IntType=int
! from pywintypes import TimeType
import pythoncom
import mapi, mapitags
***************
*** 12,16 ****
def GetPropTagName(pt):
if not prTable:
! for name, value in mapitags.__dict__.items():
if name[:3] == 'PR_':
# Store both the full ID (including type) and just the ID.
--- 11,15 ----
def GetPropTagName(pt):
if not prTable:
! for name, value in mapitags.__dict__.iteritems():
if name[:3] == 'PR_':
# Store both the full ID (including type) and just the ID.
***************
*** 38,42 ****
def GetScodeString(hr):
if not mapiErrorTable:
! for name, value in mapi.__dict__.items():
if name[:7] in ['MAPI_E_', 'MAPI_W_']:
mapiErrorTable[value] = name
--- 37,41 ----
def GetScodeString(hr):
if not mapiErrorTable:
! for name, value in mapi.__dict__.iteritems():
if name[:7] in ['MAPI_E_', 'MAPI_W_']:
mapiErrorTable[value] = name
***************
*** 48,52 ****
"""Given a mapi type flag, return a string description of the type"""
if not ptTable:
! for name, value in mapitags.__dict__.items():
if name[:3] == 'PT_':
ptTable[value] = name
--- 47,51 ----
"""Given a mapi type flag, return a string description of the type"""
if not ptTable:
! for name, value in mapitags.__dict__.iteritems():
if name[:3] == 'PT_':
ptTable[value] = name
***************
*** 142,147 ****
newProps = []
# First pass over the properties we should get IDs for.
! for key, val in propDict.items():
! if type(key) in [StringType, UnicodeType]:
newProps.append((mapi.PS_PUBLIC_STRINGS, key))
# Query for the new IDs
--- 141,146 ----
newProps = []
# First pass over the properties we should get IDs for.
! for key, val in propDict.iteritems():
! if type(key) in [str, unicode]:
newProps.append((mapi.PS_PUBLIC_STRINGS, key))
# Query for the new IDs
***************
*** 149,156 ****
newIdNo = 0
newProps = []
! for key, val in propDict.items():
! if type(key) in [StringType, UnicodeType]:
type_val=type(val)
! if type_val in [StringType, pywintypes.UnicodeType]:
tagType = mapitags.PT_UNICODE
elif type_val==IntType:
--- 148,155 ----
newIdNo = 0
newProps = []
! for key, val in propDict.iteritems():
! if type(key) in [str, unicode]:
type_val=type(val)
! if type_val in [str, unicode]:
tagType = mapitags.PT_UNICODE
elif type_val==IntType:
|