diff options
Diffstat (limited to 'source4/param/param.i')
-rw-r--r-- | source4/param/param.i | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/source4/param/param.i b/source4/param/param.i index aadca9b1fb..ca1bb69184 100644 --- a/source4/param/param.i +++ b/source4/param/param.i @@ -40,12 +40,11 @@ typedef struct param_section param_section; $1 = loadparm_init(NULL); } -%typemap(freearg) struct loadparm_context * { - talloc_free($1); -} - %rename(LoadParm) loadparm_context; +%nodefaultctor loadparm_context; +%nodefaultdtor loadparm_context; + typedef struct loadparm_context { %extend { loadparm_context(TALLOC_CTX *mem_ctx) { return loadparm_init(mem_ctx); } @@ -85,13 +84,27 @@ typedef struct param_context { int use(struct param_context *); int write(const char *fn); } + %pythoncode { + def __getitem__(self, name): + ret = self.get_section(name) + if ret is None: + raise KeyError("No such section %s" % name) + return ret + } } param; typedef struct param_section { %extend { struct param_opt *get(const char *name); } + %pythoncode { + def __getitem__(self, name): + ret = self.get_section(name) + if ret is None: + raise KeyError("No such section %s" % name) + return ret + } } param_section; %rename(default_config) global_loadparm; -struct loadparm_context *global_loadparm; +//struct loadparm_context *global_loadparm ; |