summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0a7107b)
raw | patch | inline | side by side (parent: 0a7107b)
author | Sven Trenkel <collectd@semidefinite.de> | |
Sat, 21 Nov 2009 01:56:34 +0000 (02:56 +0100) | ||
committer | Sven Trenkel <collectd@semidefinite.de> | |
Sat, 21 Nov 2009 01:56:34 +0000 (02:56 +0100) |
src/pyconfig.c | patch | blob | history | |
src/python.c | patch | blob | history |
diff --git a/src/pyconfig.c b/src/pyconfig.c
index a6b4469fa308dd7f62716dffac0e38e5f7ba6600..63b44f8851aea70ea0a49a99ddf36d7ab519d954 100644 (file)
--- a/src/pyconfig.c
+++ b/src/pyconfig.c
#include "cpython.h"
+static const char Config_doc[] = "This represents a piece of collectd's config file.\n"
+ "It is passed to scripts with config callbacks (see \"register_config\")\n"
+ "and is of little use if created somewhere else.\n"
+ "\n"
+ "It has no methods beyond the bare minimum and only exists for its\n"
+ "data members";
+
+static char parent_doc[] = "This represents the parent of this node. On the root node\n"
+ "of the config tree it will be None.\n";
+
+static char key_doc[] = "This is the keyword of this item, ie the first word of any\n"
+ "given line in the config file. It will always be a string.\n";
+
+static char values_doc[] = "This is a tuple (which might be empty) of all value, ie words\n"
+ "following the keyword in any given line in the config file.\n"
+ "\n"
+ "Every item in this tuple will be either a string or a float or a bool,\n"
+ "depending on the contents of the configuration file.\n";
+
+static char children_doc[] = "This is a tuple of child nodes. For most nodes this will be\n"
+ "empty. If this node represents a block instead of a single line of the config\n"
+ "file it will contain all nodes in this block.\n";
+
static PyObject *Config_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
Config *self;
}
static PyMemberDef Config_members[] = {
- {"Parent", T_OBJECT, offsetof(Config, parent), 0, "Parent node"},
- {"Key", T_OBJECT_EX, offsetof(Config, key), 0, "Keyword of this node"},
- {"Values", T_OBJECT_EX, offsetof(Config, values), 0, "Values after the key"},
- {"Children", T_OBJECT_EX, offsetof(Config, children), 0, "Childnodes of this node"},
+ {"parent", T_OBJECT, offsetof(Config, parent), 0, parent_doc},
+ {"key", T_OBJECT_EX, offsetof(Config, key), 0, key_doc},
+ {"values", T_OBJECT_EX, offsetof(Config, values), 0, values_doc},
+ {"children", T_OBJECT_EX, offsetof(Config, children), 0, children_doc},
{NULL}
};
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
- "Cool help text later", /* tp_doc */
+ Config_doc, /* tp_doc */
Config_traverse, /* tp_traverse */
Config_clear, /* tp_clear */
0, /* tp_richcompare */
diff --git a/src/python.c b/src/python.c
index 408229606bcdfe059577939ae173f867bdab8406..f9360c345d7218070869e0b33dad3f9e454b00ea 100644 (file)
--- a/src/python.c
+++ b/src/python.c
@@ -597,7 +597,7 @@ static PyObject *cpy_oconfig_to_pyconfig(oconfig_item_t *ci, PyObject *parent) {
return NULL;
children = PyTuple_New(ci->children_num); /* New reference. */
for (i = 0; i < ci->children_num; ++i) {
- PyTuple_SET_ITEM(children, i, cpy_oconfig_to_pyconfig(ci->children + i, item));
+ PyTuple_SET_ITEM(children, i, cpy_oconfig_to_pyconfig(ci->children + i, item));
}
tmp = ((Config *) item)->children;
((Config *) item)->children = children;