mallardwriter: Fix code for self-parameter forcing
authorJasper St. Pierre <jstpierre@mecheye.net>
Sat, 2 Feb 2013 01:01:56 +0000 (20:01 -0500)
committerJasper St. Pierre <jstpierre@mecheye.net>
Sat, 2 Feb 2013 01:17:16 +0000 (20:17 -0500)
giscanner/mallardwriter.py
tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.method.page

index ece54a9b4aeb44d06a824c27ec19338b9c34031b..a4e9c073a75f017f2416e4b434a7e7eb71511ad6 100644 (file)
@@ -404,7 +404,7 @@ class MallardFormatterPython(MallardFormatter):
 
     def format_parameter_name(self, node, parameter):
         # Force "self" for the first parameter of a method
-        if self.is_method(node) and parameter is node.parameters[0]:
+        if self.is_method(node) and parameter is node.instance_parameter:
             return "self"
         else:
             return parameter.argname
index 0b5681eb95d4f66b8b901ec487dc19d97b15dbd0..390c40c2d74c9be9c28c56c5141367bb6756e586 100644 (file)
@@ -52,7 +52,7 @@ def method(self, first_arg, second_arg, boolean_arg, pointer_arg, string):
   
     <p>This is an example of how to document a method.</p><p>You should call this on a <link xref="DocExamples.Obj"/> that was
 created with <link xref="DocExamples.Obj.new"/>, by passing it
-in as <code>obj</code>.</p><p>This should be a %FALSEALARM.</p>
+in as <code>self</code>.</p><p>This should be a %FALSEALARM.</p>
   
   
     <p>Since 0.99</p>
@@ -66,7 +66,7 @@ in as <code>obj</code>.</p><p>This should be a %FALSEALARM.</p>
 <dt><p>boolean_arg :</p></dt>
 <dd><p>You should always pass <code>True</code>.</p></dd>
 <dt><p>pointer_arg :</p></dt>
-<dd><p>If not <code>None</code>, do a thing. Pass <code>self</code> if you want to sometimes. You can also pass <code>second_arg</code>, or even <code>boolean_arg</code>.</p></dd>
+<dd><p>If not <code>None</code>, do a thing. Pass <code>first_arg</code> if you want to sometimes. You can also pass <code>second_arg</code>, or even <code>boolean_arg</code>.</p></dd>
 <dt><p>string :</p></dt>
 <dd><p>A NUL-terminated string.</p></dd>
 <dt><p>Returns :</p></dt>