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

Jan Cholasta jcholast at redhat.com
Mon Jan 2 08:09:50 UTC 2012


Dne 21.12.2011 21:49, Alexander Bokovoy napsal(a):
> 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.
>

Here you go.

Honza

-- 
Jan Cholasta
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-jcholast-54.4-fix-read-only-write.patch
Type: text/x-patch
Size: 9387 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20120102/a42a757f/attachment.bin>


More information about the Freeipa-devel mailing list