mirror of
https://github.com/Unidata/python-awips.git
synced 2025-02-23 14:57:56 -05:00
Fixing more weird python 2/3 string issues
This commit is contained in:
parent
26e109effb
commit
d38c910e24
4 changed files with 9 additions and 8 deletions
|
@ -79,6 +79,7 @@ class ThriftClient:
|
|||
rval = self.__dsm.deserializeBytes(response.read())
|
||||
self.__httpConn.close()
|
||||
|
||||
|
||||
# let's verify we have an instance of ServerErrorResponse
|
||||
# IF we do, through an exception up to the caller along
|
||||
# with the original Java stack trace
|
||||
|
|
|
@ -152,8 +152,8 @@ class ThriftSerializationContext(object):
|
|||
|
||||
def deserializeMessage(self):
|
||||
name = self.protocol.readStructBegin()
|
||||
name = name.replace(b'_', b'.')
|
||||
name = name.decode('cp437')
|
||||
name = name.replace('_', '.')
|
||||
if name.isdigit():
|
||||
obj = self._deserializeType(int(name))
|
||||
return obj
|
||||
|
@ -162,8 +162,8 @@ class ThriftSerializationContext(object):
|
|||
elif name.find('$') > -1:
|
||||
# it's an inner class, we're going to hope it's an enum, treat it special
|
||||
fieldName, fieldType, fieldId = self.protocol.readFieldBegin()
|
||||
if fieldName != b'__enumValue__':
|
||||
raise dynamiceserialize.SerializationException("Expected to find enum payload. Found: " + fieldName)
|
||||
if fieldName != '__enumValue__':
|
||||
raise dynamiceserialize.SerializationException(b"Expected to find enum payload. Found: " + fieldName)
|
||||
obj = self.protocol.readString()
|
||||
self.protocol.readFieldEnd()
|
||||
return obj
|
||||
|
|
|
@ -39,8 +39,8 @@ class SerializableExceptionWrapper(object):
|
|||
|
||||
def __repr__(self):
|
||||
if not self.message:
|
||||
self.message = ''
|
||||
retVal = "" + self.exceptionClass + " exception thrown: " + self.message + "\n"
|
||||
self.message = b''
|
||||
retVal = b"" + self.exceptionClass + b" exception thrown: " + self.message + b"\n"
|
||||
for element in self.stackTrace:
|
||||
retVal += "\tat " + str(element) + "\n"
|
||||
|
||||
|
|
|
@ -59,13 +59,13 @@ class StackTraceElement(object):
|
|||
return self.__repr__()
|
||||
|
||||
def __repr__(self):
|
||||
msg = self.declaringClass + "." + self.methodName
|
||||
msg = self.declaringClass.decode('cp437') + "." + self.methodName.decode('cp437')
|
||||
if self.isNativeMethod():
|
||||
msg += "(Native Method)"
|
||||
elif self.fileName is not None and self.lineNumber >= 0:
|
||||
msg += "(" + self.fileName + ":" + str(self.lineNumber) + ")"
|
||||
msg += "(" + self.fileName.decode('cp437') + ":" + str(self.lineNumber) + ")"
|
||||
elif self.fileName is not None:
|
||||
msg += "(" + self.fileName + ")"
|
||||
msg += "(" + self.fileName.decode('cp437') + ")"
|
||||
else:
|
||||
msg += "(Unknown Source)"
|
||||
return msg
|
||||
|
|
Loading…
Add table
Reference in a new issue