Update of /cvs-repository/Packages/ZPublisher In directory cvs.zope.org:/tmp/cvs-serv28362/lib/python/ZPublisher
Modified Files: Tag: Zope-2_7-branch Converters.py HTTPRequest.py HTTPResponse.py Log Message: - backporting Chris Withers' changes for Collector #1490: Added a new zope.conf option to control the character set used to encode unicode data that reaches ZPublisher without any specified encoding. === Packages/ZPublisher/Converters.py 1.23.2.5 => 1.23.2.6 === --- Packages/ZPublisher/Converters.py:1.23.2.5 Tue Nov 16 08:12:12 2004 +++ Packages/ZPublisher/Converters.py Sun Oct 9 19:53:57 2005 @@ -17,10 +17,13 @@ from DateTime import DateTime from cgi import escape +# This may get overwritten during configuration +default_encoding = 'iso-8859-15' + def field2string(v): if hasattr(v,'read'): return v.read() - elif isinstance(v,UnicodeType) : - return v.encode('iso-8859-15') + elif isinstance(v,UnicodeType): + return v.encode(default_encoding) else: return str(v) === Packages/ZPublisher/HTTPRequest.py 1.90.2.11 => 1.90.2.12 === --- Packages/ZPublisher/HTTPRequest.py:1.90.2.11 Thu Jul 21 12:18:41 2005 +++ Packages/ZPublisher/HTTPRequest.py Sun Oct 9 19:53:57 2005 @@ -25,6 +25,9 @@ from maybe_lock import allocate_lock xmlrpc=None # Placeholder for module that we'll import if we have to. +# This may get overwritten during configuration +default_encoding = 'iso-8859-15' + isCGI_NAME = { 'SERVER_SOFTWARE' : 1, 'SERVER_NAME' : 1, @@ -526,7 +529,7 @@ if hasattr(converter,'convert_unicode'): item = converter.convert_unicode(item) else: - item = converter(item.encode('iso-8859-15')) + item = converter(item.encode(default_encoding)) else: item=converter(item) === Packages/ZPublisher/HTTPResponse.py 1.75.2.10 => 1.75.2.11 === --- Packages/ZPublisher/HTTPResponse.py:1.75.2.10 Sat Sep 24 06:37:19 2005 +++ Packages/ZPublisher/HTTPResponse.py Sun Oct 9 19:53:57 2005 @@ -26,6 +26,8 @@ nl2sp = maketrans('\n',' ') +# This may get overwritten during configuration +default_encoding = 'iso-8859-15' # Enable APPEND_TRACEBACKS to make Zope append tracebacks like it used to, # but a better solution is to make standard_error_message display error_tb. @@ -433,7 +435,7 @@ encoding = match.group(1) return body.encode(encoding) # Use the default character encoding - return body.encode('iso-8859-15','replace') + return body.encode(default_encoding,'replace') def setBase(self,base): """Set the base URL for the returned document. _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins