Index: lib/python/App/dtml/manage.dtml =================================================================== RCS file: /home/cvs/development/external/Zope2/lib/python/App/dtml/manage.dtml,v retrieving revision 1.1.1.2 retrieving revision 1.3 diff -c -4 -r1.1.1.2 -r1.3 Index: lib/python/App/dtml/manage_page_header.dtml =================================================================== RCS file: /home/cvs/development/external/Zope2/lib/python/App/dtml/manage_page_header.dtml,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -c -4 -r1.1.1.1 -r1.2 *** lib/python/App/dtml/manage_page_header.dtml 8 Feb 2001 13:08:32 -0000 1.1.1.1 --- lib/python/App/dtml/manage_page_header.dtml 8 Feb 2001 17:25:12 -0000 1.2 *************** *** 1,7 **** --- 1,12 ---- + + + + + + *************** *** 41,49 **** ! --- 43,51 ---- ! *************** *** 65,94 **** "('%s' % getProperty(id))[:-1]" html_quote>"> "> ! ! "> CHECKED> ! ! "> ! ! ! !
! "> ! ! "> CHECKED> ! ! "> ! ! ! !
!
!
! ">
! ">
! Type --- 212,220 ---- Name
! Type *************** *** 225,234 **** --- 227,240 ---- + + + +
*************** *** 240,248 **** Value
!
--- 246,254 ---- Value
!
Index: lib/python/ZPublisher/Converters.py =================================================================== RCS file: /home/cvs/development/external/Zope2/lib/python/ZPublisher/Converters.py,v retrieving revision 1.1.1.4 retrieving revision 1.7 diff -c -4 -r1.1.1.4 -r1.7 *** lib/python/ZPublisher/Converters.py 10 Sep 2001 14:55:05 -0000 1.1.1.4 --- lib/python/ZPublisher/Converters.py 10 Sep 2001 15:32:28 -0000 1.7 *************** *** 81,89 **** # many individuals on behalf of Digital Creations. Specific # attributions are listed in the accompanying credits file. # ############################################################################## ! __version__='$Revision: 1.1.1.4 $'[11:-2] import re from string import atoi, atol, atof, join, split, strip from types import ListType, TupleType --- 81,89 ---- # many individuals on behalf of Digital Creations. Specific # attributions are listed in the accompanying credits file. # ############################################################################## ! __version__='$Revision: 1.7 $'[11:-2] import re from string import atoi, atol, atof, join, split, strip from types import ListType, TupleType *************** *** 183,190 **** --- 183,228 ---- def field2boolean(v): return v + + class _unicode_converter: + def __call__(self,v): + # Convert a regular python string. This probably doesnt do what you want, + # whatever that might be. If you are getting exceptions below, you + # probably missed the encoding tag from a form field name. Use: + # ')==l-1 and bogus_str_search(body) is not None): self.notFoundError(body[1:-1]) --- 293,315 ---- If is_error is true then the HTML will be formatted as a Zope error message instead of a generic HTML page. ''' if not body: return self ! if type(body) is types.TupleType and len(body) == 2: title,body=body if type(body) is not types.StringType: if hasattr(body,'asHTML'): body=body.asHTML() ! body=ustr(body) ! ! if type(body) is UnicodeType: ! body = self._encode_unicode(body) ! ! isHTML=self.isHTML(body) ! l=len(body) if ((l < 200) and body[:1]=='<' and find(body,'>')==l-1 and bogus_str_search(body) is not None): self.notFoundError(body[1:-1]) *************** *** 315,323 **** self.body=self._error_html(title, body) else: self.body=body - if not self.headers.has_key('content-type'): isHTML=self.isHTML(body) if isHTML: c='text/html' else: c='text/plain' --- 322,329 ---- *************** *** 335,342 **** --- 341,358 ---- self.setHeader('content-length', len(self.body)) self.insertBase() return self + def _encode_unicode(self,body,charset_re=re.compile(r'text/[0-9a-z]+\s*;\s*charset=([-_0-9a-z]+)(?:(?:\s*;)|\Z)',re.IGNORECASE)): + # Try to encode the Unicode data as requested. + if self.headers.has_key('content-type'): + match = charset_re.match(self.headers['content-type']) + if match: + encoding = match.group(1) + return body.encode(encoding) + # Choose a default character encoding. + return body.encode('latin1','replace') + def setBase(self,base): 'Set the base URL for the returned document.' if base[-1:] != '/': base=base+'/' *************** *** 344,352 **** def insertBase(self, base_re_search=re.compile('()',re.I).search ): - # Only insert a base tag if content appears to be html. content_type = split(self.headers.get('content-type', ''), ';')[0] if content_type and (content_type != 'text/html'): return --- 360,367 ---- *************** *** 595,603 **** try: # Try to capture exception info for bci calls et=translate(str(t),nl2sp) self.setHeader('bobo-exception-type',et) ! ev=translate(str(v),nl2sp) if find(ev,'') >= 0: ev='bobo exception' self.setHeader('bobo-exception-value',ev[:255]) # Get the tb tail, which is the interesting part: while tb.tb_next is not None: tb=tb.tb_next --- 610,618 ---- try: # Try to capture exception info for bci calls et=translate(str(t),nl2sp) self.setHeader('bobo-exception-type',et) ! ev=translate(ustr(v),nl2sp) if find(ev,'') >= 0: ev='bobo exception' self.setHeader('bobo-exception-value',ev[:255]) # Get the tb tail, which is the interesting part: while tb.tb_next is not None: tb=tb.tb_next *************** *** 632,667 **** b=v if isinstance(b,Exception): try: ! b=str(b) except: b='' % type(b).__name__ ! if fatal and t is SystemExit and v.code==0: tb=self.setBody( (str(t), 'Zope has exited normally.

' + self._traceback(t,v,tb)), is_error=1) - #elif 1: self.setBody(v) - - elif type(b) is not types.StringType or tag_search(b) is None: - tb=self.setBody( - (str(t), - 'Sorry, a site error occurred.

'+ - self._traceback(t,v,tb)), - is_error=1) - - elif (lower(strip(b)[:6])=='' or - lower(strip(b)[:14])=='' % type(b).__name__ ! if fatal and t is SystemExit and v.code==0: tb=self.setBody( (str(t), 'Zope has exited normally.

' + self._traceback(t,v,tb)), is_error=1) else: ! try: ! match = tag_search(b) ! except TypeError: ! match = None ! if match is None: ! tb=self.setBody( ! (str(t), ! 'Sorry, a site error occurred.

'+ ! self._traceback(t,v,tb)), ! is_error=1) ! elif lower(strip(b)[:6])=='' or lower(strip(b)[:14])=='