summaryrefslogtreecommitdiff
path: root/source4/pidl/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-04-08 02:58:18 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-04-08 02:58:18 +0200
commite5aa9f7e8dbb5b66a5ce25f50ed67dfcae7a1809 (patch)
tree3b7e182b734d2a57ab98ec018dbbcf4e7917d594 /source4/pidl/lib
parentab27e718fd88dde3c8ad716042f5c37a8e4ecab3 (diff)
downloadsamba-e5aa9f7e8dbb5b66a5ce25f50ed67dfcae7a1809.tar.gz
samba-e5aa9f7e8dbb5b66a5ce25f50ed67dfcae7a1809.tar.bz2
samba-e5aa9f7e8dbb5b66a5ce25f50ed67dfcae7a1809.zip
Raise NotImplementedError from functions that don't have complete IDL.
(This used to be commit 685aab0c99c87386fee64c07d8b68c75652713c6)
Diffstat (limited to 'source4/pidl/lib')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/Python.pm43
1 files changed, 29 insertions, 14 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 40c0cd51cb..c04324e992 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -253,17 +253,10 @@ sub PythonStruct($$$$$$)
return "&$typeobject";
}
-sub PythonFunction($$$)
+sub PythonFunctionBody($$$)
{
my ($self, $fn, $iface, $prettyname) = @_;
- my $docstring = $self->DocString($fn, $fn->{NAME});
-
- my $fnname = "py_$fn->{NAME}";
-
- $self->pidl("static PyObject *$fnname(PyObject *self, PyObject *args, PyObject *kwargs)");
- $self->pidl("{");
- $self->indent;
$self->pidl("$iface\_InterfaceObject *iface = ($iface\_InterfaceObject *)self;");
$self->pidl("NTSTATUS status;");
$self->pidl("TALLOC_CTX *mem_ctx = talloc_new(NULL);");
@@ -370,16 +363,38 @@ sub PythonFunction($$$)
$self->pidl("talloc_free(mem_ctx);");
$self->pidl("return result;");
- $self->deindent;
- $self->pidl("}");
- $self->pidl("");
- if ($docstring) {
- $docstring = "\"$signature\\n\\n\"$docstring";
+ return $signature;
+}
+
+sub PythonFunction($$$)
+{
+ my ($self, $fn, $iface, $prettyname) = @_;
+
+ my $fnname = "py_$fn->{NAME}";
+ my $docstring = $self->DocString($fn, $fn->{NAME});
+
+ $self->pidl("static PyObject *$fnname(PyObject *self, PyObject *args, PyObject *kwargs)");
+ $self->pidl("{");
+ $self->indent;
+ if (has_property($fn, "todo")) {
+ $self->pidl("PyErr_SetString(PyExc_NotImplementedError, \"No marshalling code available yet for $prettyname\");");
+ $self->pidl("return NULL;");
+ unless ($docstring) { $docstring = "NULL"; }
} else {
- $docstring = "\"$signature\"";
+ my $signature = $self->PythonFunctionBody($fn, $iface, $prettyname);
+
+ if ($docstring) {
+ $docstring = "\"$signature\\n\\n\"$docstring";
+ } else {
+ $docstring = "\"$signature\"";
+ }
}
+ $self->deindent;
+ $self->pidl("}");
+ $self->pidl("");
+
return ($fnname, $docstring);
}