Added functions to return Python tuples (error code, error string)
authorTim Potter <tpot@samba.org>
Fri, 5 Apr 2002 04:47:43 +0000 (04:47 +0000)
committerTim Potter <tpot@samba.org>
Fri, 5 Apr 2002 04:47:43 +0000 (04:47 +0000)
corresponding to NT and DOS errors.
(This used to be commit cb243e2766260f03de6b748d20734b8183cf192b)

source3/python/py_common.c
source3/python/py_common.h

index a24a6009d3a398a25738564695a237a699d9c6ce..5c2e0f896cda6de2ac1ed5b4143cdc2a31651290 100644 (file)
 */
 
 #include "includes.h"
+#include "Python.h"
+
+/* Return a tuple of (error code, error string) from a WERROR */
+
+PyObject *py_werror_tuple(WERROR werror)
+{
+       return Py_BuildValue("is", W_ERROR_V(werror), 
+                            dos_errstr(werror));
+}
+
+/* Return a tuple of (error code, error string) from a WERROR */
+
+PyObject *py_ntstatus_tuple(NTSTATUS ntstatus)
+{
+       return Py_BuildValue("is", NT_STATUS_V(ntstatus), 
+                            nt_errstr(ntstatus));
+}
 
 /* Initialise samba client routines */
 
index 1d2d4d6cd068359f9e6bf8750145f1dbcbd4f756..30a47eba25456163e849bacdddf6f76462d3df4b 100644 (file)
@@ -24,5 +24,7 @@
 /* Function prototypes */
 
 void py_samba_init(void);
+PyObject *py_werror_tuple(WERROR werror);
+PyObject *py_ntstatus_tuple(NTSTATUS ntstatus);
 
 #endif /* _PY_COMMON_H */