aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/PySide6/glue/qhttpserver.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2024-09-09 08:16:28 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2024-09-09 09:28:38 +0200
commit8e7ec5dad905f3a0ad6770d0fc6b3c48cb0c74fa (patch)
treed94dd7a3595e80f5198ed6b69cdd96e54d670383 /sources/pyside6/PySide6/glue/qhttpserver.cpp
parent9d992caec98de24ac3d649af6e37a50075f2a147 (diff)
QtHttpServer: Fix build after API review change
Adapt to qthttpserver/6acb3ccf221923a19118b3f3b15ffbebb3f33d4c. The example will be fixed in a follow-up change. Task-number: QTBUG-128113 Task-number: PYSIDE-2620 Change-Id: Ic454bcb8a37aa89ef6e9718df6dd8a7135e0b36c Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/pyside6/PySide6/glue/qhttpserver.cpp')
-rw-r--r--sources/pyside6/PySide6/glue/qhttpserver.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/sources/pyside6/PySide6/glue/qhttpserver.cpp b/sources/pyside6/PySide6/glue/qhttpserver.cpp
index b6e485e2c..c3afafb95 100644
--- a/sources/pyside6/PySide6/glue/qhttpserver.cpp
+++ b/sources/pyside6/PySide6/glue/qhttpserver.cpp
@@ -29,22 +29,23 @@ bool cppResult = %CPPSELF.%FUNCTION_NAME(rule,
%PYARG_0 = %CONVERTTOPYTHON[bool](cppResult);
// @snippet qhttpserver-route
-// @snippet qhttpserver-afterrequest
-auto *callable = %PYARG_1;
+// @snippet qhttpserver-addafterrequesthandler
+auto *callable = %PYARG_2;
-%CPPSELF.%FUNCTION_NAME([callable](QHttpServerResponse &&response,
- const QHttpServerRequest &request) {
+auto callback = [callable](const QHttpServerRequest &request,
+ QHttpServerResponse &response) {
Shiboken::GilState state;
Shiboken::AutoDecRef arglist(PyTuple_New(2));
auto *responsePtr = &response;
auto *requestPtr = &request;
PyTuple_SET_ITEM(arglist, 0,
- %CONVERTTOPYTHON[QHttpServerResponse *](responsePtr));
- PyTuple_SET_ITEM(arglist, 1,
%CONVERTTOPYTHON[QHttpServerRequest *](requestPtr));
+ PyTuple_SET_ITEM(arglist, 1,
+ %CONVERTTOPYTHON[QHttpServerResponse *](responsePtr));
PyObject_CallObject(callable, arglist);
if (PyErr_Occurred())
PyErr_Print();
- return std::move(response);
-});
-// @snippet qhttpserver-afterrequest
+};
+
+%CPPSELF.%FUNCTION_NAME(%1, callback);
+// @snippet qhttpserver-addafterrequesthandler