Return preferences of unknown type as opaque data

This commit is contained in:
Jack Jansen 1997-01-10 15:25:47 +00:00
parent 466be801fd
commit 8dc797d1f8
1 changed files with 14 additions and 1 deletions

View File

@ -28,13 +28,24 @@ icReadOnlyPerm = 1
icReadWritePerm = 2
# End of ictypes.h
class ICOpaqueData:
"""An unparseable IC entry"""
def __init__(self, data):
self.data = data
def __repr__(self):
return "ICOpaqueData(%s)"%`self.data`
_ICOpaqueDataType=type(ICOpaqueData(''))
def _decode_default(data, key):
if len(data) == 0:
return data
if ord(data[0]) == len(data)-1:
# Assume Pstring
return data[1:]
raise error, "Unknown data format for key "+key
return ICOpaqueData(data)
def _decode_multistr(data, key):
numstr = ord(data[0]) << 8 | ord(data[1])
@ -134,6 +145,8 @@ def _decode(data, key):
return decoder(data, key)
def _code(data, key):
if type(data) == _ICOpaqueDataType:
return data.data
if '\245' in key:
key2 = key[:string.index(key, '\245')+1]
else: