summaryrefslogtreecommitdiff
path: root/py/modules/IcePy/Properties.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2004-09-07 18:09:34 +0000
committerMark Spruiell <mes@zeroc.com>2004-09-07 18:09:34 +0000
commite02918bf965996710ed9ce4cf189f47fb2650180 (patch)
tree517aeb0c724dbe5fd7ac05a17257605e1bd5e274 /py/modules/IcePy/Properties.cpp
parentpass the all flag to generate() (diff)
downloadice-e02918bf965996710ed9ce4cf189f47fb2650180.tar.bz2
ice-e02918bf965996710ed9ce4cf189f47fb2650180.tar.xz
ice-e02918bf965996710ed9ce4cf189f47fb2650180.zip
accept args to createProperties
Diffstat (limited to 'py/modules/IcePy/Properties.cpp')
-rw-r--r--py/modules/IcePy/Properties.cpp48
1 files changed, 43 insertions, 5 deletions
diff --git a/py/modules/IcePy/Properties.cpp b/py/modules/IcePy/Properties.cpp
index dbadeb5b121..2d9287ea7b4 100644
--- a/py/modules/IcePy/Properties.cpp
+++ b/py/modules/IcePy/Properties.cpp
@@ -54,10 +54,48 @@ propertiesNew(PyObject* /*arg*/)
extern "C"
#endif
static int
-propertiesInit(PropertiesObject* self, PyObject* /*args*/, PyObject* /*kwds*/)
+propertiesInit(PropertiesObject* self, PyObject* args, PyObject* /*kwds*/)
{
- self->properties = new Ice::PropertiesPtr;
- *(self->properties) = Ice::createProperties();
+ PyObject* arglist = NULL;
+ if(!PyArg_ParseTuple(args, "|O!", &PyList_Type, &arglist))
+ {
+ return -1;
+ }
+
+ Ice::StringSeq seq;
+ if(arglist && !listToStringSeq(arglist, seq))
+ {
+ return -1;
+ }
+
+ Ice::PropertiesPtr props;
+ try
+ {
+ props = Ice::createProperties(seq);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ setPythonException(ex);
+ return -1;
+ }
+
+ //
+ // Replace the contents of the given argument list with the filtered arguments.
+ //
+ if(arglist)
+ {
+ if(PyList_SetSlice(arglist, 0, PyList_Size(arglist), NULL) < 0)
+ {
+ return -1;
+ }
+ if(!stringSeqToList(seq, arglist))
+ {
+ return -1;
+ }
+ }
+
+ self->properties = new Ice::PropertiesPtr(props);
+
return 0;
}
@@ -504,12 +542,12 @@ IcePy::getProperties(PyObject* p)
extern "C"
PyObject*
-Ice_createProperties(PyObject* /*self*/)
+Ice_createProperties(PyObject* /*self*/, PyObject* args)
{
//
// Currently the same as "p = Ice.Properties()".
//
- return PyObject_Call((PyObject*)&PropertiesType, NULL, NULL);
+ return PyObject_Call((PyObject*)&PropertiesType, args, NULL);
}
extern "C"