Bug with ampersand and ZPT/TAL/METAL

"Niels Dettenbach [email protected] [zms-developers]" <[email protected]> Tue, 07 Feb 2017 10:47:25 +0100
Newsgroups gmane.comp.cms.zms.devel
Organization Syndicat IT&Internet
Message-ID <3021227.c7phEoBTXr@gongo>
--nextPart2014824.TUmsJrQCo6
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"

Hiho ZMS devels,


hope you are going well.

It seem's i've hit a small bug within current ZMS3 with ampersands ("&") within strings: 

While any ampersand within any other ZMS attribute is delivered correctly trough ZPT/TAL/METAL, only the title and titlealt attributes are further escaping ampersands within ZMS3 what seems incompatible at least to the newer ZPT/TAL theming, where ZPT/TAL does proper conversion of ampersands byself.

Example:

bug:
getTitle():  "Syndicat IT &amp;amp; Internet"
getTitlealt:  "Syndicat IT &amp;amp; Internet"

but works:
attr('my_own_title'):  "Syndicat IT &amp; Internet"
attr('description'): " "Syndicat IT &amp; Internet"

I've found two lines within ZMS which i commented out which seems to work fine. There may be workaround with i.e. TAL "structure", but this would lead to new problems (i.e. user could "use" unescaped html code into title and titlealt)...

For now i did this patch.

Could someone from the devels check this please if this is OK? Even if this still has any reason - this confuses because it is not stringent through all ZMS attributes - different handling of any ZMS object attributes seems a bit ugly.

diff -u ./lib/python2.7/site-packages/Products/zms/zmsobject.py ./lib/python2.7/site-packages/Products/zms/zmsobject.py.orig
--- ./lib/python2.7/site-packages/Products/zms/zmsobject.py     2017-02-07 10:24:45.698817000 +0100
+++ ./lib/python2.7/site-packages/Products/zms/zmsobject.py.orig        2017-02-07 10:24:29.875817000 +0100
@@ -358,7 +358,7 @@
         sec_no = self.getSecNo()
         if len(sec_no) > 0:
           s = sec_no + ' ' + s
-      s = s.replace(' & ',' &amp; ')
+#      s = s.replace(' & ',' &amp; ')
       return s


@@ -386,7 +386,7 @@
         sec_no = self.getSecNo()
         if len(sec_no) > 0:
           s = sec_no + ' ' + s
-      s = s.replace(' & ',' &amp; ')
+#      s = s.replace(' & ',' &amp; ')
       return s


hth a bit further,

anyhow: many thanks for your time and
best regards,


Niels.

-- 
 ---
 Niels Dettenbach
 Syndicat IT & Internet
 http://www.syndicat.com
 PGP: https://syndicat.com/pub_key.asc
 ---
 




--nextPart2014824.TUmsJrQCo6
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part.
Content-Transfer-Encoding: 7Bit

-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEen+3H2N8RDyGzUZnDbtaiEWSKkQFAliZl60ACgkQDbtaiEWS
KkTzQBAAoJCFlv1xWZRaanqXtjY4nwH/h9APbB1Gooxr3aBtPBA1kaEdkwdTNo8d
M2Y/88QbXb0EaBGiv5QCq4RiVTQ9dzecOBnrLnv6rbcIecTT4lQn42zzXpd7xNjL
raKElyDbb77d9Gl8k2hGULLIfh8PReFb301Cje7RRn1ftjzeCfqBGFW4qNd7uWbH
sqoDgpiVngOeJGR9XWBN5oYSjw27pj64myzRy2uWhRMVX1QHFdE1K0MW9LUC4ALI
Pfsm8qYIOIkxtM+Ey/+IQemx12tECvqKApjDRksFycnXOQhUjLd3VlWugHF4p39y
cId/H9w3iBSV2SbBt7QM46r0b6bTY7Fd8VwzEMbDb/5dhtbtrobjid8x7Z7HXUpr
RzjuBCzKiTcjzMyJcm8V0IRBYvHIA8qINpzQIKujxJu1k1pXwKg29dCFT9xyVxh7
qvkHSD+VZ26Yh8rseqPdiO9fHxOSQPShC97BqQl5OStLcb1fx6anUau51dA0gBbb
b1ieofI0Y+uN6AcbjW2xEZ0WZsP6fhZUaVh+EJcpol6hqPd1aSkt1XKgil0PUq9I
o+wWmKMe6pp/um2VPR1atNCvPa94QoG5A9Ju1/Nh40VD0R9p/71jGK2DKLjgH1hB
Bri+rAVJVnRR+JHSEPNfDioxn0NFI7AWxTFYyc9uHwenfBOknHE=
=LtCY
-----END PGP SIGNATURE-----

--nextPart2014824.TUmsJrQCo6--