Commit dac2c7ce authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

patch PreferredCharsetResolver.resolve so as to handle requests that do not...

patch PreferredCharsetResolver.resolve so as to handle requests that do not have 'Accept-Charset: UTF-8' header.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38884 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1b111d9c
......@@ -61,6 +61,7 @@ from Products.ERP5Type.patches import OFSPdata
from Products.ERP5Type.patches import make_hidden_input
from Products.ERP5Type.patches import ClientStorage
from Products.ERP5Type.patches import DemoStorage
from Products.ERP5Type.patches import unicodeconflictresolver
# BACK: Forward Compatibility with Zope 2.12 or CMF 2.2. Remove when we've
# dropped support for older versions.
from Products.ERP5Type.patches import TransactionAddBeforeCommitHook
......
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
##############################################################################
try:
from Products.PageTemplates.unicodeconflictresolver \
import PreferredCharsetResolver
except ImportError:
# do nothing for Zope-2.8
pass
else:
def PreferredCharsetResolver_resolve(context, text, expression):
# Since we use UTF-8 only in PageTemplate, it is enough here. It is
# faster than the original implementation, and it is compatible with
# requests that do not contain Accept-Charset header.
return unicode(text, 'utf-8')
PreferredCharsetResolver.resolve = PreferredCharsetResolver_resolve
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment