On Fri, 14 Oct 2011, Jan Cholasta wrote:
>          Perform an HTTP request.
>          """
> -        if self.ca_host == None:
> -            self.ca_host = self._select_ca()
> +        if self.ca_host is None:
> +            object.__setattr__(self, 'ca_host', self._select_ca())
>          return dogtag.http_request(self.ca_host, port, url, **kw)
I don't like this approach as well. A better way would be to have a 
class CaCache that is mutable and allow changing its properties. Then 
you would create an instance of CaCache in ca.__init__() and ask for 
its properties later.

You can move those _select_ca(), _select_any_master(), 
_host_has_service() to CaCache as they seem to not depend on anything 
in class ca but rather use global api.env.

This way you will get is a fairly simple CaCache class reusable both 
in ca and ra classes.
/ Alexander Bokovoy

Freeipa-devel mailing list

Reply via email to