Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: CMF

Re: 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)

 

 

Zope cmf RSS feed   Index | Next | Previous | View Threaded


tseaver at palladion

Mar 23, 2011, 9:22 AM

Post #1 of 3 (773 views)
Permalink
Re: 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)

-----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.


Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver [at] palladion
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2KHi0ACgkQ+gerLs4ltQ7+UQCeMTuMFI2Eo2gSjxBbxNa23Hd0
ozYAnRle5ZDskFtBnZkeHYrvel0vUAUu
=SkWe
-----END PGP SIGNATURE-----

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


l at lrowe

Mar 23, 2011, 9:26 AM

Post #2 of 3 (741 views)
Permalink
Re: 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) [In reply to]

On 23 March 2011 16:22, Tres Seaver <tseaver [at] palladion> 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
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


tseaver at palladion

Mar 23, 2011, 9:54 AM

Post #3 of 3 (733 views)
Permalink
Re: 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) [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/23/2011 12:26 PM, Laurence Rowe wrote:
> On 23 March 2011 16:22, Tres Seaver <tseaver [at] palladion> 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?

That convention is not really as useful for XML data: it tends to break
stuff on import:

https://bugs.launchpad.net/zope-cmf/+bug/707927


Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver [at] palladion
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2KJdcACgkQ+gerLs4ltQ6XFwCeOaZXSBKxb3OsqS1KH1SX0HJg
oT0AoJfxXOa/kjqvqGWcODIFkoir4RJY
=xaS8
-----END PGP SIGNATURE-----
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests

Zope cmf RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.