mirror of
https://github.com/GNS3/gns3-gui.git
synced 2026-05-17 00:46:01 +03:00
Fix callback issues in v2.2.58
This commit is contained in:
@@ -217,7 +217,7 @@ class ComputeManager(QtCore.QObject):
|
||||
|
||||
if compute_id in self._computes:
|
||||
del self._computes[compute_id]
|
||||
self._controller.delete("/computes/{compute_id}".format(compute_id=compute_id))
|
||||
self._controller.delete("/computes/{compute_id}".format(compute_id=compute_id), None)
|
||||
self.deleted_signal.emit(compute_id)
|
||||
|
||||
def updateList(self, computes):
|
||||
|
||||
@@ -247,7 +247,7 @@ class Controller(QtCore.QObject):
|
||||
|
||||
def createHTTPQuery(self, method, path, *args, **kwargs):
|
||||
"""
|
||||
Forward the query to the HTTP client or controller depending of the path
|
||||
Forward the query to the HTTP client or controller depending on the path
|
||||
"""
|
||||
|
||||
if self._http_client:
|
||||
|
||||
@@ -580,7 +580,7 @@ class HTTPClient(QtCore.QObject):
|
||||
:param body: params to send (dictionary)
|
||||
:param callback: callback method to call when the server replies
|
||||
:param context: Pass a context to the response callback
|
||||
:param downloadProgressCallback: Callback called when received something, it can be an incomplete response
|
||||
:param downloadProgressCallback: callback called when received something, it can be an incomplete response
|
||||
:param showProgress: Display progress to the user
|
||||
:param networkManager: The network manager to use. If None use default
|
||||
:param progressText: Text display to user in progress dialog. None for auto generated
|
||||
@@ -606,7 +606,7 @@ class HTTPClient(QtCore.QObject):
|
||||
request = self._addAuth(request)
|
||||
request.setRawHeader(b"User-Agent", "GNS3 QT Client v{version}".format(version=__version__).encode())
|
||||
|
||||
# By default QT doesn't support GET with body even if it's in the RFC that's why we need to use sendCustomRequest
|
||||
# By default, QT doesn't support GET with body even if it's in the RFC that's why we need to use sendCustomRequest
|
||||
body = self._addBodyToRequest(body, request)
|
||||
|
||||
if not networkManager:
|
||||
@@ -616,12 +616,13 @@ class HTTPClient(QtCore.QObject):
|
||||
response = networkManager.sendCustomRequest(request, method.encode(), body)
|
||||
except SystemError as e:
|
||||
log.error("Can't send query: {}".format(str(e)))
|
||||
return
|
||||
return None
|
||||
|
||||
if context:
|
||||
context = copy.copy(context)
|
||||
else:
|
||||
context = {"query_id": str(uuid.uuid4())}
|
||||
context = dict()
|
||||
context["query_id"] = str(uuid.uuid4())
|
||||
|
||||
response.finished.connect(qpartial(self._processResponse, response, server, callback, context, body, ignoreErrors))
|
||||
response.errorOccurred.connect(qpartial(self._processError, response, server, callback, context, body, ignoreErrors))
|
||||
|
||||
@@ -81,7 +81,7 @@ class TemplateManager(QtCore.QObject):
|
||||
if template_id in self._templates and not self._templates[template_id].builtin():
|
||||
template = self._templates[template_id]
|
||||
log.debug("Delete template '{}' (ID={})".format(template.name(), template_id))
|
||||
self._controller.delete("/templates/{template_id}".format(template_id=template_id))
|
||||
self._controller.delete("/templates/{template_id}".format(template_id=template_id), None)
|
||||
|
||||
def deleteTemplateCallback(self, result, error=False, **kwargs):
|
||||
"""
|
||||
|
||||
@@ -136,7 +136,7 @@ def test_post_not_connected(http_client, http_request, network_manager, response
|
||||
assert callback.called
|
||||
|
||||
args, kwargs = callback.call_args
|
||||
assert kwargs["context"]["query_id"] == 42
|
||||
assert kwargs["context"]["toto"] == 42
|
||||
|
||||
|
||||
def test_post_not_connected_connection_failed(http_client, http_request, network_manager, response):
|
||||
|
||||
Reference in New Issue
Block a user