[pywin32-checkins] /hgroot/pywin32/pywin32: GetPropTagName returns the fully qualif...
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <pyw...@li...> - 2012-09-24 00:21:58
|
changeset 125b96a72be7 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=125b96a72be7 summary: GetPropTagName returns the fully qualified PT_UNICODE/PT_STRING8 type name, GetMapiTypeName tweaks (Nick Czeczulin) diffstat: CHANGES.txt | 4 ++++ com/win32comext/mapi/mapiutil.py | 28 +++++++++++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diffs (73 lines): diff -r 9648d478ad21 -r 125b96a72be7 CHANGES.txt --- a/CHANGES.txt Thu Sep 20 14:15:56 2012 -0400 +++ b/CHANGES.txt Mon Sep 24 10:21:21 2012 +1000 @@ -6,6 +6,10 @@ Since build 217: ---------------- +* mapiutil.py GetPropTagName has been modified to return the fully qualified + PT_UNICODE and PT_STRING8 type name. Added optional argument to override + rawType default in GetMapiTypeName. (Nick Czeczulin) + * Fix the count of replaced terms in Pythonwin's search/replace (rupole). * Fix obscure issues in the Pythonwin code browser and other uses of the diff -r 9648d478ad21 -r 125b96a72be7 com/win32comext/mapi/mapiutil.py --- a/com/win32comext/mapi/mapiutil.py Thu Sep 20 14:15:56 2012 -0400 +++ b/com/win32comext/mapi/mapiutil.py Mon Sep 24 10:21:21 2012 +1000 @@ -16,7 +16,6 @@ # 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 # String types should have 3 definitions in mapitags.py # PR_BODY = PROP_TAG( PT_TSTRING, 4096) @@ -25,11 +24,21 @@ # The following change ensures a lookup using only the the # property id returns the conditional default. - if (mapitags.PROP_TYPE(value) == mapitags.PT_UNICODE or \ - mapitags.PROP_TYPE(value) == mapitags.PT_STRING8) and \ - (name[-2:] == '_A' or name[-2:] == '_W'): - continue - prTable[mapitags.PROP_ID(value)] = name + # PT_TSTRING is a conditional assignment for either PT_UNICODE or + # PT_STRING8 and should not be returned during a lookup. + + if mapitags.PROP_TYPE(value) == mapitags.PT_UNICODE or \ + mapitags.PROP_TYPE(value) == mapitags.PT_STRING8: + + if name[-2:] == '_A' or name[-2:] == '_W': + prTable[value] = name + else: + prTable[mapitags.PROP_ID(value)] = name + + else: + prTable[value] = name + prTable[mapitags.PROP_ID(value)] = name + try: try: return prTable[pt] @@ -55,7 +64,7 @@ ptTable = {} -def GetMapiTypeName(propType): +def GetMapiTypeName(propType, rawType=True): """Given a mapi type flag, return a string description of the type""" if not ptTable: for name, value in mapitags.__dict__.iteritems(): @@ -67,8 +76,9 @@ continue ptTable[value] = name - rawType = propType & ~mapitags.MV_FLAG - return ptTable.get(rawType, str(hex(rawType))) + if rawType: + propType = propType & ~mapitags.MV_FLAG + return ptTable.get(propType, str(hex(propType))) def GetProperties(obj, propList): """Given a MAPI object and a list of properties, return a list of property values. |