Skip to content

Commit

Permalink
- deal with forward compatibility with Zope 2.14
Browse files Browse the repository at this point in the history
- avoid charset negotiation
  • Loading branch information
Unknown committed Mar 8, 2011
1 parent 46c87a0 commit aa823d2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changelog
1.0.5 - unreleased
------------------

* Deal with forward compatibility with Zope 2.14.

* Avoid charset negotiation.

1.0.4 - 2011-02-06
------------------
Expand Down
2 changes: 1 addition & 1 deletion buildout.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[buildout]
extends = http://download.zope.org/Zope2/index/2.13.3/versions.cfg
extends = http://download.zope.org/Zope2/index/2.13.5/versions.cfg
parts = test
develop = .

Expand Down
10 changes: 5 additions & 5 deletions src/five/formlib/formbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#
##############################################################################
"""Five baseclasses for zope.formlib.form
$Id$
"""
import os.path

Expand All @@ -24,7 +22,8 @@
_ = MessageFactory("zope")

from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from Products.Five.browser.decode import processInputs, setPageEncoding
from Products.Five.browser.decode import processInputs
from ZPublisher import HTTPRequest

_FORMLIB_DIR = os.path.dirname(zope.formlib.__file__)
_PAGEFORM_PATH = os.path.join(_FORMLIB_DIR, 'pageform.pt')
Expand All @@ -45,8 +44,9 @@ class FiveFormlibMixin(object):
# decoded first and the page encoding is set before proceeding.

def update(self):
processInputs(self.request)
setPageEncoding(self.request)
# BBB: for Zope < 2.14
if not getattr(self.request, 'postProcessInputs', False):
processInputs(self.request, [HTTPRequest.default_encoding])
super(FiveFormlibMixin, self).update()


Expand Down
4 changes: 2 additions & 2 deletions src/five/formlib/tests/formlib.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Let's set up a testbrowser:
... from Products.Five.testbrowser import Browser

>>> browser = Browser()
>>> browser.addHeader('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7')
>>> browser.addHeader('Accept-Language', 'en-US')
>>> browser.addHeader('Authorization', 'Basic manager:r00t')

Expand All @@ -69,7 +68,8 @@ like the traditional AddView and EditView, supports unicode:
>>> browser.getControl(name="form.actions.apply").click()
>>> isinstance(folder.content_1.title, unicode)
True
>>> folder.content_1.title == ni_hao.decode('utf-8')
>>> from ZPublisher import HTTPRequest
>>> folder.content_1.title == ni_hao.decode(HTTPRequest.default_encoding)
True

Adding a new content object, with two list items:
Expand Down

0 comments on commit aa823d2

Please sign in to comment.