[Zope] manage_changeProperties has strange side effect on
response Content-Type.
Gaute Amundsen
gaute at div.org
Mon Jun 19 04:19:03 EDT 2006
On Friday 16 June 2006 20:28, Dieter Maurer wrote:
> 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.
Makes perfect sense when you put it like that, I guess.
But I woluld never have guessed it from reading the APIdoc...
I would have liked to ad a comment about this in the doc, but that function
seems to be out of order for both FF, and Opera.
Thanks anyway.
Gaute
More information about the Zope
mailing list