[Zope] manage_changeProperties has strange side effect on response Content-Type.

Dieter Maurer dieter at handshake.de
Fri Jun 16 14:28:43 EDT 2006


Gaute Amundsen wrote at 2006-6-16 13:05 +0200:
>All my pages normally have a content-type of ISO-8859-1
>I have not spent much thought on this, it has just worked nicely like that.
>
>Today I had a page that called a python script, that even when I made it 
>return an empty string, changed the content-type of my page to utf-8.
>
>I finally tracked it down to this difference:
>
>item.manage_changeProperties({'title':'Hustype'}) 	gives utf-8.

"manage_changeProperties" has two usage modes: one for programmatic
use and one for ZMI use. As many other management functions,
it distinquishes between the two mode by checking whether
"REQUEST" is "None". When used from the ZMI, the ZPublisher
passes in "REQUEST" which therefore is not None.

You passed a positional argument to "manage_changeProperties"
which it interprets as "REQUEST". Therefore, it thinks it were
used from the ZMI and uses the "management_charset" (or something
like that) as encoding.

Use "manage_changeProperties(**dict)" instead of
"manage_changeProperties(dict)" to avoid this problem.



-- 
Dieter


More information about the Zope mailing list