<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2015-03-16 9:48 GMT+08:00 Alex Xu <span dir="ltr"><<a href="mailto:soulxu@gmail.com" target="_blank">soulxu@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">2015-03-13 19:10 GMT+08:00 Sean Dague <span dir="ltr"><<a href="mailto:sean@dague.net" target="_blank">sean@dague.net</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div>On 03/13/2015 02:55 AM, Chris Friesen wrote:<br>
> On 03/12/2015 12:13 PM, Sean Dague wrote:<br>
>> On 03/12/2015 02:03 PM, Chris Friesen wrote:<br>
>>> Hi,<br>
>>><br>
>>> I'm having an issue with microversions.<br>
>>><br>
>>> The api_version() code has a comment saying "This decorator MUST appear<br>
>>> first (the outermost decorator) on an API method for it to work<br>
>>> correctly"<br>
>>><br>
>>> I tried making a microversioned static class method like this:<br>
>>><br>
>>> @wsgi.Controller.api_version("2.4") # noqa<br>
>>> @staticmethod<br>
>>> def _my_func(req, foo):<br>
>>><br>
>>> and pycharm highlighted the api_version decorator and complained that<br>
>>> "This decorator will not receive a callable it may expect; the built-in<br>
>>> decorator returns a special object."<br>
>>><br>
>>> Is this a spurious warning from pycharm? The pep8 checks don't<br>
>>> complain.<br>
>>><br>
>>> If I don't make it static, then pycharm suggests that the method could<br>
>>> be static.<br>
>><br>
>> *API method*<br>
>><br>
>> This is not intended for use by methods below the top controller level.<br>
>> If you want conditionals lower down in your call stack pull the request<br>
>> version out yourself and use that.<br>
><br>
> Both the original spec and doc/source/devref/api_microversions.rst<br>
> contain text talking about decorating a private method. The latter<br>
> gives this example:<br>
><br>
> @api_version("2.1", "2.4")<br>
> def _version_specific_func(self, req, arg1):<br>
> pass<br>
><br>
> @api_version(min_version="2.5") #noqa<br>
> def _version_specific_func(self, req, arg1):<br>
> pass<br>
><br>
> def show(self, req, id):<br>
> .... common stuff ....<br>
> self._version_specific_func(req, "foo")<br>
> .... common stuff ....<br>
><br>
> It's entirely possible that such a private method might not need to<br>
> reference "self", and could therefore be static, so I think it's a valid<br>
> question.<br>
<br>
</div></div>That's a doc bug, we should change it.<br></blockquote><div><br></div><div><br></div></div></div><div>Actually it is not a bug. It's controversial point in the spec, but finally that was keep in the spec.</div><div><a href="http://specs.openstack.org/openstack/nova-specs/specs/kilo/approved/api-microversions.html" target="_blank">http://specs.openstack.org/openstack/nova-specs/specs/kilo/approved/api-microversions.html</a><br></div><div><br></div><div>The discussion at line 268 <a href="https://review.openstack.org/#/c/127127/7/specs/kilo/approved/api-microversions.rst" target="_blank">https://review.openstack.org/#/c/127127/7/specs/kilo/approved/api-microversions.rst</a></div></div></div></div></blockquote><div><br></div><div>Submit a patch for devref <a href="https://review.openstack.org/164555">https://review.openstack.org/164555</a> Let see whether we can get agreement....</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span><br>
-Sean<br>
<br>
--<br>
Sean Dague<br>
<a href="http://dague.net" target="_blank">http://dague.net</a><br>
<br>
</span><div><div>__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</div></div></blockquote></span></div><br></div></div>
</blockquote></div><br></div></div>