Jan Cholasta wrote:
Dne 14.10.2011 10:19, Alexander Bokovoy napsal(a):
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.

I don't like the idea of introducing a new class every time we need a
ReadOnly attribute to be writable. There's quite a few places in the
code where we do object.__setattr__ on ReadOnly objects. IMO the right
thing to do would be to add means of whitelisting ReadOnly attributes
that need to stay writable after locking.

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.


What is the status of this patch?


Freeipa-devel mailing list

Reply via email to