[Freeipa-devel] [PATCH 0023] Add optional_create flag

Petr Viktorin pviktori at redhat.com
Mon Oct 7 12:26:06 UTC 2013


On 10/04/2013 10:01 PM, Nathaniel McCallum wrote:
> On Fri, 2013-10-04 at 13:37 -0400, Nathaniel McCallum wrote:
>> This patch is preparatory for the OTP CLI patch.
>
> I'm not quite sure why, but this patch apparently changes the output
> of ./makeapi. This change is now included in the attached patch. Is this
> a mistake of some sort? Or is this just correct?
>
> Nathaniel

Apparently, Param.clone() uses all options, even those that are left out 
of what API.txt reports (see __kw and __clonekw in Param.__init__). IMO 
it's not ideal behavior, makeapi should have used __clonekw directly.


Anyway, to keep API.txt as before, only clone if necessary:

      def __clone(self, param, **kw):
          if 'optional_create' in param.flags:
              kw['required'] = False
-        return param.clone(**kw)
+        if kw:
+            return param.clone(**kw)
+        else:
+            return param


-- 
Petr³




More information about the Freeipa-devel mailing list