Index: external/Zope2/lib/python/DocumentTemplate/DT_In.py diff -c external/Zope2/lib/python/DocumentTemplate/DT_In.py:1.1.1.2 external/Zope2/lib/python/DocumentTemplate/DT_In.py:1.2 *** external/Zope2/lib/python/DocumentTemplate/DT_In.py:1.1.1.2 Thu Jun 22 12:04:53 2000 --- external/Zope2/lib/python/DocumentTemplate/DT_In.py Fri Jul 7 14:39:05 2000 *************** *** 382,391 **** ''' #' ! __rcs_id__='$Id: DT_In.py,v 1.1.1.2 2000/06/22 11:04:53 tdickenson Exp $' ! __version__='$Revision: 1.1.1.2 $'[11:-2] ! from DT_Util import ParseError, parse_params, name_param, str from DT_Util import render_blocks, InstanceDict, ValidationError from string import find, atoi, join, split import ts_regex --- 382,391 ---- ''' #' ! __rcs_id__='$Id: DT_In.py,v 1.2 2000/07/07 13:39:05 tdickenson Exp $' ! __version__='$Revision: 1.2 $'[11:-2] ! from DT_Util import ParseError, parse_params, name_param, str, join_unicode from DT_Util import render_blocks, InstanceDict, ValidationError from string import find, atoi, join, split import ts_regex *************** *** 614,620 **** if index==first: kw['sequence-start']=0 ! result=join(result, '') finally: if cache: pop() --- 614,620 ---- if index==first: kw['sequence-start']=0 ! result = join_unicode(result, '') finally: if cache: pop() *************** *** 692,698 **** finally: pop() if index==0: kw['sequence-start']=0 ! result=join(result, '') finally: if cache: pop() --- 692,698 ---- finally: pop() if index==0: kw['sequence-start']=0 ! result=join_unicode(result, '') finally: if cache: pop() Index: external/Zope2/lib/python/DocumentTemplate/DT_Util.py diff -c external/Zope2/lib/python/DocumentTemplate/DT_Util.py:1.1.1.2 external/Zope2/lib/python/DocumentTemplate/DT_Util.py:1.5 *** external/Zope2/lib/python/DocumentTemplate/DT_Util.py:1.1.1.2 Thu Jun 22 12:04:53 2000 --- external/Zope2/lib/python/DocumentTemplate/DT_Util.py Tue Jul 11 12:40:45 2000 *************** *** 82,89 **** # attributions are listed in the accompanying credits file. # ############################################################################## ! '''$Id: DT_Util.py,v 1.1.1.2 2000/06/22 11:04:53 tdickenson Exp $''' ! __version__='$Revision: 1.1.1.2 $'[11:-2] import regex, string, math, os from string import strip, join, atoi, lower, split, find --- 82,89 ---- # attributions are listed in the accompanying credits file. # ############################################################################## ! '''$Id: DT_Util.py,v 1.5 2000/07/11 11:40:45 tdickenson Exp $''' ! __version__='$Revision: 1.5 $'[11:-2] import regex, string, math, os from string import strip, join, atoi, lower, split, find *************** *** 94,110 **** ParseError='Document Template Parse Error' ValidationError='Unauthorized' - def html_quote(v, name='(Unknown name)', md={}, character_entities=( (('&'), '&'), (('<'), '<' ), (('>'), '>' ), ! (('\213'), '<' ), ! (('\233'), '>' ), (('"'), '"'))): #" ! text=str(v) ! for re,name in character_entities: if find(text, re) >= 0: text=join(split(text,re),name) return text --- 94,112 ---- ParseError='Document Template Parse Error' ValidationError='Unauthorized' def html_quote(v, name='(Unknown name)', md={}, character_entities=( (('&'), '&'), (('<'), '<' ), (('>'), '>' ), ! ! # What are these two needed for????? ! #(('\213'), '<' ), ! #(('\233'), '>' ), ! (('"'), '"'))): #" ! text=ustr(v) ! for re,name in character_entities: if find(text, re) >= 0: text=join(split(text,re),name) return text *************** *** 211,220 **** from cDocumentTemplate import cDocument except: from pDocumentTemplate import InstanceDict, TemplateDict, render_blocks - d=TemplateDict.__dict__ for name in ('None', 'abs', 'chr', 'divmod', 'float', 'hash', 'hex', 'int', ! 'len', 'max', 'min', 'oct', 'ord', 'round', 'str'): d[name]=__builtins__[name] d['string']=string d['math']=math --- 213,222 ---- from cDocumentTemplate import cDocument except: from pDocumentTemplate import InstanceDict, TemplateDict, render_blocks d=TemplateDict.__dict__ for name in ('None', 'abs', 'chr', 'divmod', 'float', 'hash', 'hex', 'int', ! 'len', 'max', 'min', 'oct', 'ord', 'round', 'str', ! 'unicode', 'unichr', 'ustr',): d[name]=__builtins__[name] d['string']=string d['math']=math *************** *** 535,537 **** --- 532,553 ---- text=strip(text[l:]) if text: return apply(parse_params,(text,result),parms) else: return result + + + def join_unicode(sequence,sep=' '): + # Unicode aware join. + # This does roughly the same job as string.join, however this function will + # not report an error if there is a mix of unicode string and 8bit strings + # with the 7th bit set. Instead, the 8bit strings are interpreted as strings + # of latin-1 characters. + # This is the preferred way of combining content for Zope responses. + try: + return join(sequence, '') + except UnicodeError: + # A mix of unicode string and normal strings with the 7th bit. + # Python considers this mix more dangerous than I do. + for i in range(len(sequence)): + if type(sequence[i]) is type(''): + sequence[i] = unicode(sequence[i],'latin-1') + return join(sequence, sep) + \ No newline at end of file Index: external/Zope2/lib/python/DocumentTemplate/DT_Var.py diff -c external/Zope2/lib/python/DocumentTemplate/DT_Var.py:1.1.1.2 external/Zope2/lib/python/DocumentTemplate/DT_Var.py:1.2 *** external/Zope2/lib/python/DocumentTemplate/DT_Var.py:1.1.1.2 Thu Jun 22 12:04:53 2000 --- external/Zope2/lib/python/DocumentTemplate/DT_Var.py Fri Jul 7 14:39:05 2000 *************** *** 217,224 **** ''' # ' ! __rcs_id__='$Id: DT_Var.py,v 1.1.1.2 2000/06/22 11:04:53 tdickenson Exp $' ! __version__='$Revision: 1.1.1.2 $'[11:-2] from DT_Util import parse_params, name_param, html_quote, str import regex, string, sys, regex --- 217,224 ---- ''' # ' ! __rcs_id__='$Id: DT_Var.py,v 1.2 2000/07/07 13:39:05 tdickenson Exp $' ! __version__='$Revision: 1.2 $'[11:-2] from DT_Util import parse_params, name_param, html_quote, str import regex, string, sys, regex *************** *** 314,321 **** # finally, pump it through the actual string format... fmt=self.fmt ! if fmt=='s': val=str(val) ! else: val = ('%'+self.fmt) % (val,) # next, look for upper, lower, etc for f in self.modifiers: val=f(val) --- 314,323 ---- # finally, pump it through the actual string format... fmt=self.fmt ! if fmt=='s': ! val=ustr(val) ! else: ! val = ('%'+self.fmt) % (val,) # next, look for upper, lower, etc for f in self.modifiers: val=f(val) Index: external/Zope2/lib/python/DocumentTemplate/__init__.py diff -c external/Zope2/lib/python/DocumentTemplate/__init__.py:1.1.1.1 external/Zope2/lib/python/DocumentTemplate/__init__.py:1.3 *** external/Zope2/lib/python/DocumentTemplate/__init__.py:1.1.1.1 Fri Apr 28 21:06:55 2000 --- external/Zope2/lib/python/DocumentTemplate/__init__.py Tue Jul 11 12:15:16 2000 *************** *** 87,95 **** This wrapper allows the (now many) document template modules to be segregated in a separate package. ! $Id: __init__.py,v 1.1.1.1 2000/04/28 20:06:55 tdickenson Exp $''' ! __version__='$Revision: 1.1.1.1 $'[11:-2] import ExtensionClass # work-around for import bug. from DocumentTemplate import String, File, HTML, HTMLDefault, HTMLFile from DocumentTemplate import html_quote --- 87,111 ---- This wrapper allows the (now many) document template modules to be segregated in a separate package. ! $Id: __init__.py,v 1.3 2000/07/11 11:15:16 tdickenson Exp $''' ! __version__='$Revision: 1.3 $'[11:-2] + try: + ustr + except: + # This ustr function was not provided in early python 1.6 alpha releases + import __builtin__ + def ustr(v): + if type(v)==type(u''): + return v + else: + return str(v) + __builtin__.ustr = ustr + del __builtin__ + del ustr + + import ExtensionClass # work-around for import bug. from DocumentTemplate import String, File, HTML, HTMLDefault, HTMLFile from DocumentTemplate import html_quote + Index: external/Zope2/lib/python/DocumentTemplate/cDocumentTemplate.c diff -c external/Zope2/lib/python/DocumentTemplate/cDocumentTemplate.c:1.1.1.2 external/Zope2/lib/python/DocumentTemplate/cDocumentTemplate.c:1.3 *** external/Zope2/lib/python/DocumentTemplate/cDocumentTemplate.c:1.1.1.2 Thu Jun 22 12:04:53 2000 --- external/Zope2/lib/python/DocumentTemplate/cDocumentTemplate.c Tue Jul 11 12:15:16 2000 *************** *** 84,95 **** ****************************************************************************/ static char cDocumentTemplate_module_documentation[] = "" ! "\n$Id: cDocumentTemplate.c,v 1.1.1.2 2000/06/22 11:04:53 tdickenson Exp $" ; #include "ExtensionClass.h" ! static PyObject *py_isDocTemp=0, *py_blocks=0, *py_=0, *join=0, *py_acquire; static PyObject *py___call__, *py___roles__, *py_AUTHENTICATED_USER; static PyObject *py_hasRole, *py__proxy_roles, *py_Unauthorized; static PyObject *py_Unauthorized_fmt, *py_validate; --- 84,95 ---- ****************************************************************************/ static char cDocumentTemplate_module_documentation[] = "" ! "\n$Id: cDocumentTemplate.c,v 1.3 2000/07/11 11:15:16 tdickenson Exp $" ; #include "ExtensionClass.h" ! static PyObject *py_isDocTemp=0, *py_blocks=0, *py_=0, *join=0, *py_acquire, *ustr=0; static PyObject *py___call__, *py___roles__, *py_AUTHENTICATED_USER; static PyObject *py_hasRole, *py__proxy_roles, *py_Unauthorized; static PyObject *py_Unauthorized_fmt, *py_validate; *************** *** 736,742 **** block=PyTuple_GET_ITEM(block,0); if (PyString_Check(block)) block=PyObject_GetItem(md,block); else block=PyObject_CallObject(block,mda); ! if (block) ASSIGN(block, PyObject_Str(block)); UNLESS(block) return -1; } else --- 736,742 ---- block=PyTuple_GET_ITEM(block,0); if (PyString_Check(block)) block=PyObject_GetItem(md,block); else block=PyObject_CallObject(block,mda); ! if (block) ASSIGN(block,PyObject_CallFunction(ustr,"O",block)); UNLESS(block) return -1; } else *************** *** 813,819 **** if (if_finally(md,0) == -2) return -1; } } ! else if (PyString_Check(block)) { Py_INCREF(block); } --- 813,819 ---- if (if_finally(md,0) == -2) return -1; } } ! else if (PyString_Check(block) || PyUnicode_Check(block)) { Py_INCREF(block); } *************** *** 833,842 **** return 0; } static PyObject * render_blocks(PyObject *self, PyObject *args) { ! PyObject *md, *blocks, *mda=0, *rendered=0; int l; UNLESS(PyArg_ParseTuple(args,"OO", &blocks, &md)) return NULL; --- 833,871 ---- return 0; } + + static int + render_unicode_fixup(PyObject *list) + { + PyObject *string,*unicode; + int i,l; + + l = PyList_Size(list); + + for(i=0;i= 0: ! error_message=error_value elif (type(error_value) is StringType and tagSearch(error_value) >= 0): error_message=error_value --- 232,244 ---- if not error_message: if type(error_value) is InstanceType: ! try: ! s=str(error_value) ! except: ! pass ! else: ! if tagSearch(s) >= 0: ! error_message=error_value elif (type(error_value) is StringType and tagSearch(error_value) >= 0): error_message=error_value Index: external/Zope2/lib/python/OFS/properties.dtml diff -c external/Zope2/lib/python/OFS/properties.dtml:1.1.1.2 external/Zope2/lib/python/OFS/properties.dtml:1.7 *** external/Zope2/lib/python/OFS/properties.dtml:1.1.1.2 Thu Jun 22 12:04:54 2000 --- external/Zope2/lib/python/OFS/properties.dtml Tue Jul 11 15:00:30 2000 *************** *** 1,7 **** --- 1,23 ---- + + + Does this 'Properties' tab need to support any browsers that do not understand utf8? + I cant say 'No' for certain :-( + + + + + + + + + + + Properties + "> *************** *** 30,36 **** ! --- 46,52 ---- ! *************** *** 50,74 **** "> ! ! "> CHECKED> ! ! "> ! ! ! ! ! "> ! ! "> CHECKED> ! ! "> ! ! ! ! ! "> ! Type ! Type ! *************** *** 173,179 **** Value ! --- 193,199 ---- Value ! *************** *** 186,188 **** --- 206,209 ---- + Index: external/Zope2/lib/python/Products/ZCatalog/Catalog.py diff -c external/Zope2/lib/python/Products/ZCatalog/Catalog.py:1.1.1.2 external/Zope2/lib/python/Products/ZCatalog/Catalog.py:1.4 *** external/Zope2/lib/python/Products/ZCatalog/Catalog.py:1.1.1.2 Thu Jun 22 12:04:55 2000 --- external/Zope2/lib/python/Products/ZCatalog/Catalog.py Fri Jun 30 08:38:21 2000 *************** *** 533,540 **** append((k,LazyMap(self.__getitem__, intset))) else: for r in rs: ! append(sort_index._unindex[r], ! LazyMap(self.__getitem__,[r])) return used --- 533,540 ---- append((k,LazyMap(self.__getitem__, intset))) else: for r in rs: ! append((sort_index._unindex[r], ! LazyMap(self.__getitem__,[r]))) return used Index: external/Zope2/lib/python/ZLogger/ZLogger.py diff -c external/Zope2/lib/python/ZLogger/ZLogger.py:1.1.1.1 external/Zope2/lib/python/ZLogger/ZLogger.py:1.2 *** external/Zope2/lib/python/ZPublisher/Converters.py:1.1.1.1 Fri Apr 28 21:07:08 2000 --- external/Zope2/lib/python/ZPublisher/Converters.py Tue Jul 11 15:00:30 2000 *************** *** 82,88 **** # attributions are listed in the accompanying credits file. # ############################################################################## ! __version__='$Revision: 1.1.1.1 $'[11:-2] import regex from string import atoi, atol, atof, join, split, strip --- 82,88 ---- # attributions are listed in the accompanying credits file. # ############################################################################## ! __version__='$Revision: 1.4 $'[11:-2] import regex from string import atoi, atol, atof, join, split, strip *************** *** 159,164 **** --- 159,202 ---- 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 body[:1]=='<' and l < 200 and --- 298,308 ---- if hasattr(body,'asHTML'): body=body.asHTML() ! body=ustr(body) ! ! if type(body) is UnicodeType: ! body = self._encode_unicode(body) ! l=len(body) if (find(body,'>')==l-1 and body[:1]=='<' and l < 200 and *************** *** 316,321 **** --- 321,336 ---- 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+'/' *************** *** 327,333 **** regex.casefold).search ): if (self.headers.has_key('content-type') and ! self.headers['content-type'] != 'text/html'): return if self.base: body=self.body --- 342,348 ---- regex.casefold).search ): if (self.headers.has_key('content-type') and ! self.headers['content-type'][:9] != 'text/html'): return if self.base: body=self.body *************** *** 616,622 **** except: pass b=v ! if isinstance(b,Exception): b=str(b) if fatal and t is SystemExit and v.code==0: tb=self.setBody( --- 631,641 ---- except: pass b=v ! if isinstance(b,Exception): ! try: ! b=str(b) ! except: ! b = "object at %x" % id(b) if fatal and t is SystemExit and v.code==0: tb=self.setBody( *************** *** 626,632 **** is_error=1) #elif 1: self.setBody(v) ! elif type(b) is not types.StringType or tag_search(b) < 0: tb=self.setBody( (str(t), 'Sorry, a Zope error occurred.

'+ --- 645,651 ---- is_error=1) #elif 1: self.setBody(v) ! elif type(b) is not types.StringType and type(b) is not types.UnicodeType or tag_search(b) < 0: tb=self.setBody( (str(t), 'Sorry, a Zope error occurred.

'+ *************** *** 685,691 **** c='text/plain' self.setHeader('content-type',c) else: ! isHTML = headers['content-type']=='text/html' if isHTML and end_of_header_search(self.body) < 0: lhtml=html_search(body) if lhtml >= 0: --- 704,710 ---- c='text/plain' self.setHeader('content-type',c) else: ! isHTML = headers['content-type'][:9]=='text/html' if isHTML and end_of_header_search(self.body) < 0: lhtml=html_search(body) if lhtml >= 0: