[gobject-introspection/wip/doctool-improvements: 12/14] doc: Add self to methods in the Python declarations



commit dfe8115c77519f9e3d505000fb2a82e14a777cf6
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jan 9 02:43:38 2013 -0500

    doc: Add self to methods in the Python declarations

 giscanner/mallard-Python-function.tmpl             |    3 +++
 .../DocExamples.Obj.method.page                    |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/giscanner/mallard-Python-function.tmpl b/giscanner/mallard-Python-function.tmpl
index 9ccc723..03a3e39 100644
--- a/giscanner/mallard-Python-function.tmpl
+++ b/giscanner/mallard-Python-function.tmpl
@@ -56,6 +56,9 @@ ${formatter.format_type(arg.type) | x}\
 @returns(${formatter.format_type(node.retval.type) | x})
 def \
 ${node.name}(\
+% if node.is_method:
+self, \
+% endif
 % for arg, ix in zip(node.parameters, range(len(node.parameters))):
 ${arg.argname}\
 % if ix != len(node.parameters) - 1:
diff --git a/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.method.page b/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.method.page
index 3a20d14..8447be6 100644
--- a/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.method.page
+++ b/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.method.page
@@ -43,7 +43,7 @@
 <synopsis><code mime="text/x-python">
 @accepts(gint, gfloat, gboolean, gpointer, utf8)
 @returns(gboolean)
-def method(first_arg, second_arg, boolean_arg, pointer_arg, string):
+def method(self, first_arg, second_arg, boolean_arg, pointer_arg, string):
     # Python wrapper for doc_examples_obj_method()
 </code></synopsis>
 <p>This is an example of how to document a method.</p><p>You should call this on a <link xref="DocExamples.Obj">DocExamples.Obj</link> that was



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]