
6 Apr
2017
6 Apr
'17
3:15 p.m.
On 6 April 2017 at 18:00, Fabrice Bacchella <fabrice.bacchella@orange.fr> wrote:
Ho my good, in ovirtsdk.services.py, for every service, there is a different method with a different name that return a associated service, so it's not possible to have a generic like:
def resolve(service, ...): id = ..... return service.service(id)
because the generic call service is used by something that take a path argument. But why not a service_by_id(self, id) ?
I think you can use getattr to get a generic call like you want: With your example code: def resolve(service, ...): id = ..... return getattr(services, service + '_service')(id) -- Barak Korren bkorren@redhat.com RHCE, RHCi, RHV-DevOps Team https://ifireball.wordpress.com/