[Zope-CMF] SVN: Products.GenericSetup/trunk/Products/GenericSetup/utils.py If exported value is None, attribute value is empty string (fixes a crash on contentrules configuration export)

Laurence Rowe l at lrowe.co.uk
Wed Mar 23 12:26:14 EDT 2011


On 23 March 2011 16:22, Tres Seaver <tseaver at palladion.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 03/23/2011 11:33 AM, Thomas Desvenain wrote:
>> Log message for revision 121096:
>>   If exported value is None, attribute value is empty string (fixes a crash on contentrules configuration export)
>>
>> Changed:
>>   U   Products.GenericSetup/trunk/Products/GenericSetup/utils.py
>>
>> -=-
>> Modified: Products.GenericSetup/trunk/Products/GenericSetup/utils.py
>> ===================================================================
>> --- Products.GenericSetup/trunk/Products/GenericSetup/utils.py        2011-03-23 15:23:20 UTC (rev 121095)
>> +++ Products.GenericSetup/trunk/Products/GenericSetup/utils.py        2011-03-23 15:33:52 UTC (rev 121096)
>> @@ -350,7 +350,12 @@
>>
>>          for a_name in a_names:
>>              wrapper.write()
>> -            a_value = escape(attrs[a_name].value.encode('utf-8'), quote=True)
>> +            a_value = attrs[a_name].value
>> +            if a_value is None:
>> +                a_value = ""
>> +            else:
>> +                a_value = escape(a_value.encode('utf-8'), quote=True))
>> +
>>              wrapper.queue(' %s="%s"' % (a_name, a_value))
>>
>>          if self.childNodes:
>
>
> We also need a test which exercises / asserts this new behavior.

In general in Zope, or at least with ZPT, None implies that an
attribute should be dropped. Would it be possible to preserve that
convention here?

Laurence


More information about the Zope-CMF mailing list