summaryrefslogtreecommitdiffstats
path: root/source/python/py_common.c
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-05-17 02:25:37 +0000
committerTim Potter <tpot@samba.org>2002-05-17 02:25:37 +0000
commit4cafbcb205af11c478a2d9047554315915933e5d (patch)
tree1d52fa21d55de9ed1611f7ee16846d6aaa838484 /source/python/py_common.c
parentb26d9d793914b66050c374ec2c0e94fa37c7e0e4 (diff)
downloadsamba-4cafbcb205af11c478a2d9047554315915933e5d.tar.gz
samba-4cafbcb205af11c478a2d9047554315915933e5d.tar.xz
samba-4cafbcb205af11c478a2d9047554315915933e5d.zip
Added a utility function to extract the info key from a dictionary.
Diffstat (limited to 'source/python/py_common.c')
-rw-r--r--source/python/py_common.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/python/py_common.c b/source/python/py_common.c
index 61eacced271..85305d027e9 100644
--- a/source/python/py_common.c
+++ b/source/python/py_common.c
@@ -197,3 +197,20 @@ struct cli_state *open_pipe_creds(char *server, PyObject *creds,
return cli;
}
+
+/* Return true if a dictionary contains a "level" key with an integer
+ value. Set the value if so. */
+
+BOOL get_level_value(PyObject *dict, uint32 *level)
+{
+ PyObject *obj;
+
+ if (!(obj = PyDict_GetItemString(dict, "level")) ||
+ !PyInt_Check(obj))
+ return False;
+
+ if (level)
+ *level = PyInt_AsLong(obj);
+
+ return True;
+}