summaryrefslogtreecommitdiff
path: root/pidl/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-12-12 13:31:42 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-12-12 13:31:42 +0100
commit3e2c070395d2fef232ab60d075194091f7b46b35 (patch)
tree0f4de6eaa1550c8700d5190997820fe94ee2c5df /pidl/lib
parent850abaffbe057f504d47ae91ea6f3ad544d39ebe (diff)
downloadsamba-3e2c070395d2fef232ab60d075194091f7b46b35.tar.gz
samba-3e2c070395d2fef232ab60d075194091f7b46b35.tar.bz2
samba-3e2c070395d2fef232ab60d075194091f7b46b35.zip
Allow overriding repr function for pidl-defined types.
Diffstat (limited to 'pidl/lib')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/Python.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 2c64f06aa4..2664275934 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -295,6 +295,10 @@ sub PythonStruct($$$$$$)
$self->pidl_hdr("#define $name\_Check(op) PyObject_TypeCheck(op, &$name\_Type)\n");
$self->pidl_hdr("#define $name\_CheckExact(op) ((op)->ob_type == &$name\_Type)\n");
$self->pidl_hdr("\n");
+ $self->pidl("#ifndef ".uc("py_$name\_repr"));
+ $self->pidl("#define ".uc("py_$name\_repr") . " py_talloc_default_repr");
+ $self->pidl("#endif");
+ $self->pidl("");
my $docstring = ($self->DocString($d, $name) or "NULL");
my $typeobject = "$name\_Type";
$self->pidl("PyTypeObject $typeobject = {");
@@ -304,7 +308,7 @@ sub PythonStruct($$$$$$)
$self->pidl(".tp_basicsize = sizeof(py_talloc_Object),");
$self->pidl(".tp_dealloc = py_talloc_dealloc,");
$self->pidl(".tp_getset = $getsetters,");
- $self->pidl(".tp_repr = py_talloc_default_repr,");
+ $self->pidl(".tp_repr = ".uc("py_$name\_repr").",");
$self->pidl(".tp_doc = $docstring,");
$self->pidl(".tp_methods = $py_methods,");
$self->pidl(".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,");