comparison Sources/RestCallbacks.cpp @ 117:1029689d7b6e

fix
author Alain Mazy <am@osimis.io>
date Mon, 28 Aug 2023 16:18:37 +0200
parents 32a67788a336
children a3f77cf16396
comparison
equal deleted inserted replaced
116:32a67788a336 117:1029689d7b6e
131 std::unique_ptr<PythonObject> pyGet; 131 std::unique_ptr<PythonObject> pyGet;
132 std::vector<boost::shared_ptr<PythonString> > pyGetValues; 132 std::vector<boost::shared_ptr<PythonString> > pyGetValues;
133 std::unique_ptr<PythonObject> pyHeaders; 133 std::unique_ptr<PythonObject> pyHeaders;
134 std::vector<boost::shared_ptr<PythonString> > pyHeaderValues; 134 std::vector<boost::shared_ptr<PythonString> > pyHeaderValues;
135 std::unique_ptr<PythonObject> pyBody; 135 std::unique_ptr<PythonObject> pyBody;
136 std::unique_ptr<PythonObject> pyGroups;
137 136
138 PythonString pyMethod(lock, method); 137 PythonString pyMethod(lock, method);
139 PyDict_SetItemString(kw.GetPyObject(), "method", pyMethod.GetPyObject()); 138 PyDict_SetItemString(kw.GetPyObject(), "method", pyMethod.GetPyObject());
140 139
141 PythonObject pyGroups(lock, PyTuple_New(request->groupsCount)); 140 PythonObject pyGroups(lock, PyTuple_New(request->groupsCount));
142 for (uint32_t i = 0; i < request->groupsCount; i++) 141 for (uint32_t i = 0; i < request->groupsCount; i++)
143 { 142 {
144 PythonString tmp(lock, request->groups[i]); 143 PythonString tmp(lock, request->groups[i]);
145 PyTuple_SetItem(pyGroups->GetPyObject(), i, tmp.Release()); // this PyTuple_SetItem method "steals" a reference -> no need to manage memory by ourselves ! 144 PyTuple_SetItem(pyGroups.GetPyObject(), i, tmp.Release()); // this PyTuple_SetItem method "steals" a reference -> no need to manage memory by ourselves !
146 } 145 }
147 146
148 PyDict_SetItemString(kw.GetPyObject(), "groups", pyGroups->GetPyObject()); 147 PyDict_SetItemString(kw.GetPyObject(), "groups", pyGroups.GetPyObject());
149 148
150 if (request->method == OrthancPluginHttpMethod_Get) 149 if (request->method == OrthancPluginHttpMethod_Get)
151 { 150 {
152 pyGet.reset(new PythonObject(lock, PyDict_New())); 151 pyGet.reset(new PythonObject(lock, PyDict_New()));
153 for (uint32_t i = 0; i < request->getCount; i++) 152 for (uint32_t i = 0; i < request->getCount; i++)