示例#1
0
    def __getitem__(self, key):
        if key == 'Data':
            try:
                return ''.join([chr(i) for i in self.fields[key]])
            except ValueError:
                # We might have Unicode chars in here, let's use unichr instead
                LOG.debug('ValueError exception on %s' % self.fields[key])
                LOG.debug('Switching to unichr()')
                return ''.join([chr(i) for i in self.fields[key]])

        else:
            return NDR.__getitem__(self, key)
示例#2
0
 def __getitem__(self, key):
     if key == 'Data':
         return self.fields[key].decode('utf-16le')
     else:
         return NDR.__getitem__(self, key)