From 1ab45841cc7ecfcfeba7a41ecfc34791171f41fa Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 17 May 2002 02:25:37 +0000 Subject: Added a utility function to extract the info key from a dictionary. (This used to be commit 4cafbcb205af11c478a2d9047554315915933e5d) --- source3/python/py_common.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source3/python/py_common.c') diff --git a/source3/python/py_common.c b/source3/python/py_common.c index 61eacced27..85305d027e 100644 --- a/source3/python/py_common.c +++ b/source3/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; +} -- cgit