RefactoringRope/JsonServer.py

branch
server_client_variant
changeset 209
c1dce8630555
parent 208
df77c3a4976d
child 210
8b07adc3cb87
equal deleted inserted replaced
208:df77c3a4976d 209:c1dce8630555
128 128
129 @param idString id of the connection been disconnected 129 @param idString id of the connection been disconnected
130 @type str 130 @type str
131 """ 131 """
132 if idString: 132 if idString:
133 connection = self.__connections[idString] 133 try:
134 connection = self.__connections[idString]
135 except KeyError:
136 connection = None
134 else: 137 else:
135 connection = self.__connection 138 connection = self.__connection
136 139
137 while connection and connection.canReadLine(): 140 while connection and connection.canReadLine():
138 data = connection.readLine() 141 data = connection.readLine()
182 "params": params, 185 "params": params,
183 } 186 }
184 cmd = json.dumps(commandDict) + '\n' 187 cmd = json.dumps(commandDict) + '\n'
185 188
186 if idString: 189 if idString:
187 connection = self.__connections[idString] 190 try:
191 connection = self.__connections[idString]
192 except KeyError:
193 connection = None
188 else: 194 else:
189 connection = self.__connection 195 connection = self.__connection
190 196
191 if connection is not None: 197 if connection is not None:
192 connection.write(cmd.encode('utf8', 'backslashreplace')) 198 connection.write(cmd.encode('utf8', 'backslashreplace'))

eric ide

mercurial