Re: [openstack-dev] [Ceilometer] Way to get wrapped method's name/class using Pecan secure decorators?

2014-08-21 Thread Doug Hellmann
lled by the secure tag: >>>>>> >>>>>> class RBACController(object): >>>>>> global _ENFORCER >>>>>> if not _ENFORCER: >>>>>> _ENFORCER = policy.Enforcer() >>>>>> >>>>>

Re: [openstack-dev] [Ceilometer] Way to get wrapped method's name/class using Pecan secure decorators?

2014-08-20 Thread Pendergrass, Eric
t; > > > > In check_permissions I'd like to know the class and method with > > > > > the > > @secure tag that caused check_permissions to be invoked. In this > > case, that would be MetersController.get_all. > > > > > > &

Re: [openstack-dev] [Ceilometer] Way to get wrapped method's name/class using Pecan secure decorators?

2014-08-15 Thread Ryan Petrello
he > @secure tag that caused check_permissions to be invoked. In this case, that > would be MetersController.get_all. > > >> > > >> Thanks > > >> > > >> > > >>> Can you share some code? What do you mean by, "is there a way for the >

Re: [openstack-dev] [Ceilometer] Way to get wrapped method's name/class using Pecan secure decorators?

2014-08-14 Thread Doug Hellmann
gt;>>> >>>>> Can you share some code? What do you mean by, "is there a way for the > decorator code to know it was called by MetersController.get_all" >>>>> >>>>> On 08/12/14 04:46 PM, Pendergrass, Eric wrote: >>>>>

Re: [openstack-dev] [Ceilometer] Way to get wrapped method's name/class using Pecan secure decorators?

2014-08-14 Thread Pendergrass, Eric
> >>> > >>> On 08/12/14 04:46 PM, Pendergrass, Eric wrote: > >>>> Thanks Ryan, but for some reason the controller attribute is None: > >>>> > >>>> (Pdb) from pecan.core import state > >>>> (Pdb) state.__dict_

Re: [openstack-dev] [Ceilometer] Way to get wrapped method's name/class using Pecan secure decorators?

2014-08-12 Thread Doug Hellmann
tribute is None: >>>> >>>> (Pdb) from pecan.core import state >>>> (Pdb) state.__dict__ >>>> {'hooks': [, >>>> , >>>> , >>>> ], 'app': >>>> , 'request': >>> 0x3ed7390 GET h

Re: [openstack-dev] [Ceilometer] Way to get wrapped method's name/class using Pecan secure decorators?

2014-08-12 Thread Ryan Petrello
; > (Pdb) state.__dict__ > > > {'hooks': [, > > > , > > > , > > > ], 'app': > > > , 'request': > > 0x3ed7390 GET http://localhost:8777/v2/meters>, 'controller': None, > > > 'response': } >

Re: [openstack-dev] [Ceilometer] Way to get wrapped method's name/class using Pecan secure decorators?

2014-08-12 Thread Pendergrass, Eric
> 'response': } > > > > > -Original Message- > > > From: Ryan Petrello [mailto:ryan.petre...@dreamhost.com] > > > Sent: Tuesday, August 12, 2014 10:34 AM > > > To: OpenStack Development Mailing List (not for usage questions) > > &

Re: [openstack-dev] [Ceilometer] Way to get wrapped method's name/class using Pecan secure decorators?

2014-08-12 Thread Ryan Petrello
> > From: Ryan Petrello [mailto:ryan.petre...@dreamhost.com] > > Sent: Tuesday, August 12, 2014 10:34 AM > > To: OpenStack Development Mailing List (not for usage questions) > > Subject: Re: [openstack-dev] [Ceilometer] Way to get wrapped method's > > name/c

Re: [openstack-dev] [Ceilometer] Way to get wrapped method's name/class using Pecan secure decorators?

2014-08-12 Thread Pendergrass, Eric
} > -Original Message- > From: Ryan Petrello [mailto:ryan.petre...@dreamhost.com] > Sent: Tuesday, August 12, 2014 10:34 AM > To: OpenStack Development Mailing List (not for usage questions) > Subject: Re: [openstack-dev] [Ceilometer] Way to get wrapped method's > name

Re: [openstack-dev] [Ceilometer] Way to get wrapped method's name/class using Pecan secure decorators?

2014-08-12 Thread Ryan Petrello
This should give you what you need: from pecan.core import state state.controller On 08/12/14 04:08 PM, Pendergrass, Eric wrote: > Hi, I'm trying to use the built in secure decorator in Pecan for access > control, and I'ld like to get the name of the method that is wrapped from > within the dec

Re: [openstack-dev] [Ceilometer] Way to get wrapped method's name/class using Pecan secure decorators?

2014-08-12 Thread Joshua Harlow
Do u know if ceilometer is using six.wraps? If so, that helper adds in the `__wrapped__` attribute to decorated methods (which can be used to find the original decorated function). If just plain functools are used (and python3.x isn't used) then it will be pretty hard afaik to find the origin

[openstack-dev] [Ceilometer] Way to get wrapped method's name/class using Pecan secure decorators?

2014-08-12 Thread Pendergrass, Eric
Hi, I'm trying to use the built in secure decorator in Pecan for access control, and I'ld like to get the name of the method that is wrapped from within the decorator. For instance, if I'm wrapping MetersController.get_all with an @secure decorator, is there a way for the decorator code to know