[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)

Tres Seaver tseaver at palladion.com
Wed Mar 23 12:22:05 EDT 2011


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



More information about the Zope-CMF mailing list