[pywin32-checkins] pywin32/com/win32comext/mapi mapiutil.py,1.4,1.5
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2004-01-20 01:24:11
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/mapi In directory sc8-pr-cvs1:/tmp/cvs-serv27802/com/win32comext/mapi Modified Files: mapiutil.py Log Message: When looking for the name of a property, handle the fact that the returned property tag may have the 'correct' ID, but the wrong type (generally the type will be PT_ERROR indicating the property doesn't actually exist). However, we still need to handle the fact that the same ID with different types will yield different property names. Index: mapiutil.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/mapi/mapiutil.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mapiutil.py 10 Mar 2003 01:03:13 -0000 1.4 --- mapiutil.py 20 Jan 2004 01:24:08 -0000 1.5 *************** *** 14,19 **** for name, value in mapitags.__dict__.items(): if name[:3] == 'PR_': prTable[value] = name ! return prTable.get(pt, hex(pt)) mapiErrorTable = {} --- 14,37 ---- for name, value in mapitags.__dict__.items(): if name[:3] == 'PR_': + # Store both the full ID (including type) and just the ID. + # This is so PR_FOO_A and PR_FOO_W are still differentiated, + # but should we get a PT_FOO with PT_ERROR set, we fallback + # to the ID. prTable[value] = name ! prTable[mapitags.PROP_ID(value)] = name ! try: ! try: ! return prTable[pt] ! except KeyError: ! # Can't find it exactly - see if the raw ID exists. ! return prTable[mapitags.PROP_ID(pt)] ! except KeyError: ! # god-damn bullshit hex() warnings: I don't see a way to get the ! # old behaviour without a warning!! ! ret = hex(long(pt)) ! # -0x8000000L -> 0x80000000 ! if ret[0]=='-': ret = ret[1:] ! if ret[-1]=='L': ret = ret[:-1] ! return ret mapiErrorTable = {} |