[Freeipa-devel] [PATCH] 54 Fix attempted write to attribute of read-only object

Alexander Bokovoy abokovoy at redhat.com
Wed Dec 21 20:49:54 UTC 2011


On Wed, 21 Dec 2011, Jan Cholasta wrote:
> 
> Fixed cachedproperty so that the return value is cached per-instance
> instead of per-class.
> 
> Updated patch attached.
Works for me, thanks.

Could you please do a favor and use the decorator syntax as suggested 
by the documentation of cachedproperty class?

> @@ -1218,7 +1219,6 @@ class ra(rabase.rabase):
>          self.ipa_key_size = "2048"
>          self.ipa_certificate_nickname = "ipaCert"
>          self.ca_certificate_nickname = "caCert"
> -        self.ca_host = None
>          try:
>              f = open(self.pwd_file, "r")
>              self.password = f.readline().strip()
> @@ -1283,6 +1283,7 @@ class ra(rabase.rabase):
>              return host
>          else:
>              return api.env.ca_host

Instead of
> +    ca_host = cachedproperty(_select_ca)
rather have
       @cachedproperty
       def ca_host(self):

where ca_host() is _select_ca().

Decorators are supported by Python 2.4.

-- 
/ Alexander Bokovoy




More information about the Freeipa-devel mailing list