Formulator 1.6.0 and Zope 2.7.0-b3

Clemens Robbenhaar <robbenhaar-WaVJUzJ3u31Wk0Htik3J/[email protected]> Mon, 5 Jan 2004 22:39:59 +0100
Newsgroups gmane.comp.web.zope.formulator.devel
Message-ID <[email protected]>
Hi Nik,

 > 
 > Hi all,
 > 
 > I got a Type Error "cannot concatenate 'str' and 'Python Method' 
 > objects" using Formulator 1.6.0 on Zope 2.7.0-b3
 > 
 > This comes from an Eval-Call of  
 > "RESPONSE.setHeader('Content-Type','text/html;charset='+management_page_charset)"
 > 

hm, thats in "./lib/python/App/dtml/manage_page_header.dtml"

Previously this has been something like:
<dtml-call "REQUEST.set('management_page_charset',_['management_page_charset'])">

followed by some:

<dtml-call "RESPONSE.setHeader('content-type','text/html;charset='+REQUEST['management_page_charset'])">

Seems someone changed the code so that the implicit call if
"management_page_charset" is callable has been bypassed. Not nice :/
(though more explicit).

Just commenting out the "management_page_charset" may have bad
effects if editing non ascii values via the ZMI when not in unicode mode.

 Maybe redefining "management_page_charset" as "ComputedAttribute"
would help instead?

This may look like:

from ComputedAttribute import ComputedAttribute

[...]

   def _management_page_charset(self):
        if not self.unicode_mode:
            return self.stored_encoding
        else:
            return 'UTF-8'

   security.declareProtected('Access contents information',
                             'management_page_charset')
   management_page_charset = ComputedAttribute(_management_page_charset)


Cheers,
Clemens