[openstack-dev] [nova] is it possible to microversion a static class method?

Alex Xu soulxu at gmail.com
Fri Mar 13 01:35:50 UTC 2015


2015-03-13 2:13 GMT+08:00 Sean Dague <sean at dague.net>:

> On 03/12/2015 02:03 PM, Chris Friesen wrote:
> > Hi,
> >
> > I'm having an issue with microversions.
> >
> > The api_version() code has a comment saying "This decorator MUST appear
> > first (the outermost decorator) on an API method for it to work
> correctly"
> >
> > I tried making a microversioned static class method like this:
> >
> >     @wsgi.Controller.api_version("2.4")  # noqa
> >     @staticmethod
> >     def _my_func(req, foo):
> >
> > and pycharm highlighted the api_version decorator and complained that
> > "This decorator will not receive a callable it may expect; the built-in
> > decorator returns a special object."
> >
> > Is this a spurious warning from pycharm?  The pep8 checks don't complain.
> >
> > If I don't make it static, then pycharm suggests that the method could
> > be static.
>
> *API method*
>
> This is not intended for use by methods below the top controller level.
> If you want conditionals lower down in your call stack pull the request
> version out yourself and use that.
>

++


>
>         -Sean
>
> --
> Sean Dague
> http://dague.net
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150313/412c03a5/attachment.html>


More information about the OpenStack-dev mailing list