On 6 April 2017 at 18:00, Fabrice Bacchella <fabrice.bacche...@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 bkor...@redhat.com RHCE, RHCi, RHV-DevOps Team https://ifireball.wordpress.com/ _______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users