diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-06-14 12:20:12 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-06-14 12:20:12 +0200 |
commit | 3443954c2bf971c3506aa40667989a10d5769706 (patch) | |
tree | d5404560c81d083aa4047efe5382907eadfc089d | |
parent | 5bc9ef0e33ed2827cbd2ab03b58a6de9220ad86d (diff) | |
download | samba-3443954c2bf971c3506aa40667989a10d5769706.tar.gz samba-3443954c2bf971c3506aa40667989a10d5769706.tar.bz2 samba-3443954c2bf971c3506aa40667989a10d5769706.zip |
Use proper python errors.
(This used to be commit f54084b65fce67457cb838544c83ceb17c7d88db)
-rw-r--r-- | source4/lib/registry/registry.i | 2 | ||||
-rw-r--r-- | source4/lib/registry/registry_wrap.c | 42 |
2 files changed, 17 insertions, 27 deletions
diff --git a/source4/lib/registry/registry.i b/source4/lib/registry/registry.i index 9420ba2014..c55197c3d0 100644 --- a/source4/lib/registry/registry.i +++ b/source4/lib/registry/registry.i @@ -35,6 +35,7 @@ typedef struct registry_context reg; typedef struct hive_key hive_key; %} +%include "../../libcli/util/errors.i" /* FIXME: This should be in another file */ %typemap(default,noblock=1) struct auth_session_info * { @@ -44,7 +45,6 @@ typedef struct hive_key hive_key; %import "stdint.i" %import "../../lib/talloc/talloc.i" %import "../../auth/credentials/credentials.i" -%import "../../libcli/util/errors.i" %import "../../param/param.i" %import "../events/events.i" diff --git a/source4/lib/registry/registry_wrap.c b/source4/lib/registry/registry_wrap.c index b066e42b41..e939e4101d 100644 --- a/source4/lib/registry/registry_wrap.c +++ b/source4/lib/registry/registry_wrap.c @@ -2554,6 +2554,9 @@ typedef struct registry_context reg; typedef struct hive_key hive_key; +#include "libcli/util/pyerrors.h" + + #include <limits.h> #if !defined(SWIG_NO_LLONG_MAX) # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) @@ -2942,8 +2945,7 @@ SWIGINTERN PyObject *_wrap_Registry(PyObject *SWIGUNUSEDPARM(self), PyObject *ar if (!SWIG_Python_UnpackTuple(args,"Registry",0,0,0)) SWIG_fail; result = reg_open_local(arg1,arg2); if (!W_ERROR_IS_OK(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); + PyErr_SetWERROR(result); SWIG_fail; } else if (resultobj == NULL) { resultobj = Py_None; @@ -2993,8 +2995,7 @@ SWIGINTERN PyObject *_wrap_reg_get_predefined_key_by_name(PyObject *SWIGUNUSEDPA arg3 = (struct registry_key **)(argp3); result = reg_get_predefined_key_by_name(arg1,(char const *)arg2,arg3); if (!W_ERROR_IS_OK(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); + PyErr_SetWERROR(result); SWIG_fail; } else if (resultobj == NULL) { resultobj = Py_None; @@ -3036,8 +3037,7 @@ SWIGINTERN PyObject *_wrap_reg_key_del_abs(PyObject *SWIGUNUSEDPARM(self), PyObj arg2 = (char *)(buf2); result = reg_key_del_abs(arg1,(char const *)arg2); if (!W_ERROR_IS_OK(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); + PyErr_SetWERROR(result); SWIG_fail; } else if (resultobj == NULL) { resultobj = Py_None; @@ -3087,8 +3087,7 @@ SWIGINTERN PyObject *_wrap_reg_get_predefined_key(PyObject *SWIGUNUSEDPARM(self) arg3 = (struct registry_key **)(argp3); result = reg_get_predefined_key(arg1,arg2,arg3); if (!W_ERROR_IS_OK(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); + PyErr_SetWERROR(result); SWIG_fail; } else if (resultobj == NULL) { resultobj = Py_None; @@ -3128,8 +3127,7 @@ SWIGINTERN PyObject *_wrap_reg_diff_apply(PyObject *SWIGUNUSEDPARM(self), PyObje arg2 = (char *)(buf2); result = reg_diff_apply(arg1,(char const *)arg2); if (!W_ERROR_IS_OK(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); + PyErr_SetWERROR(result); SWIG_fail; } else if (resultobj == NULL) { resultobj = Py_None; @@ -3186,8 +3184,7 @@ SWIGINTERN PyObject *_wrap_reg_generate_diff(PyObject *SWIGUNUSEDPARM(self), PyO } result = reg_generate_diff(arg1,arg2,(struct reg_diff_callbacks const *)arg3,arg4); if (!W_ERROR_IS_OK(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); + PyErr_SetWERROR(result); SWIG_fail; } else if (resultobj == NULL) { resultobj = Py_None; @@ -3252,8 +3249,7 @@ SWIGINTERN PyObject *_wrap_reg_mount_hive__SWIG_0(PyObject *SWIGUNUSEDPARM(self) } result = reg_mount_hive(arg1,arg2,arg3,(char const **)arg4); if (!W_ERROR_IS_OK(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); + PyErr_SetWERROR(result); SWIG_fail; } else if (resultobj == NULL) { resultobj = Py_None; @@ -3365,8 +3361,7 @@ SWIGINTERN PyObject *_wrap_reg_mount_hive__SWIG_1(PyObject *SWIGUNUSEDPARM(self) arg3 = (char *)(buf3); result = reg_mount_hive__SWIG_1(arg1,arg2,(char const *)arg3); if (!W_ERROR_IS_OK(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); + PyErr_SetWERROR(result); SWIG_fail; } else if (resultobj == NULL) { resultobj = Py_None; @@ -3531,8 +3526,7 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar } result = reg_open_hive(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7); if (!W_ERROR_IS_OK(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); + PyErr_SetWERROR(result); SWIG_fail; } else if (resultobj == NULL) { resultobj = Py_None; @@ -3620,8 +3614,7 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar } result = reg_open_ldb_file(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7); if (!W_ERROR_IS_OK(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); + PyErr_SetWERROR(result); SWIG_fail; } else if (resultobj == NULL) { resultobj = Py_None; @@ -3661,8 +3654,7 @@ SWIGINTERN PyObject *_wrap_create_dir(PyObject *SWIGUNUSEDPARM(self), PyObject * arg2 = (char *)(buf2); result = reg_create_directory(arg1,(char const *)arg2,arg3); if (!W_ERROR_IS_OK(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); + PyErr_SetWERROR(result); SWIG_fail; } else if (resultobj == NULL) { resultobj = Py_None; @@ -3702,8 +3694,7 @@ SWIGINTERN PyObject *_wrap_open_dir(PyObject *SWIGUNUSEDPARM(self), PyObject *ar arg2 = (char *)(buf2); result = reg_open_directory(arg1,(char const *)arg2,arg3); if (!W_ERROR_IS_OK(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); + PyErr_SetWERROR(result); SWIG_fail; } else if (resultobj == NULL) { resultobj = Py_None; @@ -3781,8 +3772,7 @@ SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject * } result = reg_open_samba(arg1,arg2,arg3,arg4,arg5,arg6); if (!W_ERROR_IS_OK(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); + PyErr_SetWERROR(result); SWIG_fail; } else if (resultobj == NULL) { resultobj = Py_None; |