[Checkins] SVN: plone.z3cform/trunk/ remove use of collective.monkeypatcher, and stop supporting old Zopes
David Glick
cvs-admin at zope.org
Sun May 20 19:28:25 UTC 2012
Log message for revision 126406:
remove use of collective.monkeypatcher, and stop supporting old Zopes
Changed:
U plone.z3cform/trunk/docs/HISTORY.txt
U plone.z3cform/trunk/plone/z3cform/__init__.py
D plone.z3cform/trunk/plone/z3cform/bbb/
U plone.z3cform/trunk/plone/z3cform/configure.zcml
U plone.z3cform/trunk/plone/z3cform/layout.py
U plone.z3cform/trunk/plone/z3cform/patch.py
U plone.z3cform/trunk/plone/z3cform/widget.py
U plone.z3cform/trunk/plone/z3cform/z2.py
U plone.z3cform/trunk/setup.py
-=-
Modified: plone.z3cform/trunk/docs/HISTORY.txt
===================================================================
--- plone.z3cform/trunk/docs/HISTORY.txt 2012-05-20 15:26:10 UTC (rev 126405)
+++ plone.z3cform/trunk/docs/HISTORY.txt 2012-05-20 19:28:21 UTC (rev 126406)
@@ -4,6 +4,9 @@
0.8 - unreleased
----------------
+* Remove backwards-compatibility code for Zope < 2.12
+ [davisagli]
+
* Use plone.testing for functional test layer support.
[hannosch]
Modified: plone.z3cform/trunk/plone/z3cform/__init__.py
===================================================================
--- plone.z3cform/trunk/plone/z3cform/__init__.py 2012-05-20 15:26:10 UTC (rev 126405)
+++ plone.z3cform/trunk/plone/z3cform/__init__.py 2012-05-20 19:28:21 UTC (rev 126406)
@@ -1,6 +1,5 @@
import zope.i18nmessageid
MessageFactory = zope.i18nmessageid.MessageFactory('plone.z3cform')
-# backport bug fixes
-from bbb import term
-term.apply_patch()
\ No newline at end of file
+from plone.z3cform.patch import apply_patch
+apply_patch()
Modified: plone.z3cform/trunk/plone/z3cform/configure.zcml
===================================================================
--- plone.z3cform/trunk/plone/z3cform/configure.zcml 2012-05-20 15:26:10 UTC (rev 126405)
+++ plone.z3cform/trunk/plone/z3cform/configure.zcml 2012-05-20 19:28:21 UTC (rev 126406)
@@ -14,23 +14,6 @@
<i18n:registerTranslations directory="locales"/>
- <!-- Monkey patch BaseForm/GroupForm's update() to apply Zope 2 input
- parameter processing. Without this, we'll get errors because Zope is
- sending encoded str's when z3c.form wants decoded unicode's.
- -->
- <monkey:patch
- description="Zope 2 integration - decode form inputs prior to form processing"
- class="z3c.form.form.BaseForm"
- original="update"
- replacement=".patch.BaseForm_update"
- />
- <monkey:patch
- description="Zope 2 integration - decode form inputs prior to form processing"
- class="z3c.form.group.GroupForm"
- original="update"
- replacement=".patch.GroupForm_update"
- />
-
<!-- Override the FileUploadDataConverter from z3c.form.
We register it for the class so that it is more specific than the one
registered in z3c.form. This avoids the need for a messy
Modified: plone.z3cform/trunk/plone/z3cform/layout.py
===================================================================
--- plone.z3cform/trunk/plone/z3cform/layout.py 2012-05-20 15:26:10 UTC (rev 126405)
+++ plone.z3cform/trunk/plone/z3cform/layout.py 2012-05-20 19:28:21 UTC (rev 126406)
@@ -8,11 +8,7 @@
from zope.pagetemplate.interfaces import IPageTemplate
-try:
- from Products.Five.browser.pagetemplatefile import BoundPageTemplate
- HAS_BOUND_PAGETEMPLATE = True
-except ImportError:
- HAS_BOUND_PAGETEMPLATE = False
+from Products.Five.browser.pagetemplatefile import BoundPageTemplate
from plone.z3cform import interfaces
from plone.z3cform import z2
@@ -84,10 +80,7 @@
if self.index is None:
template = zope.component.getMultiAdapter(
(self, self.request), IPageTemplate)
- if HAS_BOUND_PAGETEMPLATE:
- return BoundPageTemplate(template, self)()
- else:
- return template.__of__(self)(self)
+ return BoundPageTemplate(template, self)()
return self.index()
def label(self):
Modified: plone.z3cform/trunk/plone/z3cform/patch.py
===================================================================
--- plone.z3cform/trunk/plone/z3cform/patch.py 2012-05-20 15:26:10 UTC (rev 126405)
+++ plone.z3cform/trunk/plone/z3cform/patch.py 2012-05-20 19:28:21 UTC (rev 126406)
@@ -28,3 +28,7 @@
processInputs(self.request)
_original_GroupForm_update(self)
+
+def apply_patch():
+ BaseForm.update = BaseForm_update
+ GroupForm.update = GroupForm_update
Modified: plone.z3cform/trunk/plone/z3cform/widget.py
===================================================================
--- plone.z3cform/trunk/plone/z3cform/widget.py 2012-05-20 15:26:10 UTC (rev 126405)
+++ plone.z3cform/trunk/plone/z3cform/widget.py 2012-05-20 19:28:21 UTC (rev 126406)
@@ -9,9 +9,6 @@
import z3c.form.interfaces
class SingleCheckBoxWidget(z3c.form.browser.checkbox.SingleCheckBoxWidget):
- """XXX: We need to refactor this and patch z3c.form where
- it makes sense.
- """
def update(self):
self.ignoreContext = True
Modified: plone.z3cform/trunk/plone/z3cform/z2.py
===================================================================
--- plone.z3cform/trunk/plone/z3cform/z2.py 2012-05-20 15:26:10 UTC (rev 126405)
+++ plone.z3cform/trunk/plone/z3cform/z2.py 2012-05-20 19:28:21 UTC (rev 126406)
@@ -3,8 +3,7 @@
from zope.publisher.browser import isCGI_NAME
from zope.publisher.interfaces.browser import IBrowserApplicationRequest
-from zope.i18n.interfaces import IUserPreferredLanguages, IUserPreferredCharsets
-from zope.i18n.locales import locales, LoadLocaleError
+from zope.i18n.interfaces import IUserPreferredCharsets
import z3c.form.interfaces
@@ -62,34 +61,6 @@
pass
return text
-# This is ripped from zope.publisher.http.HTTPRequest; it is only
-# necessary in Zope < 2.11
-def setup_locale(request):
- envadapter = IUserPreferredLanguages(request, None)
- if envadapter is None:
- return None
-
- langs = envadapter.getPreferredLanguages()
- for httplang in langs:
- parts = (httplang.split('-') + [None, None])[:3]
- try:
- return locales.getLocale(*parts)
- except LoadLocaleError:
- # Just try the next combination
- pass
- else:
- # No combination gave us an existing locale, so use the default,
- # which is guaranteed to exist
- return locales.getLocale(None, None, None)
-
-# XXX Add a getURL method on the request object; this is only necessary in
-# Zope < 2.11
-def add_getURL(request):
- def getURL(level=0, path_only=False):
- assert level == 0 and path_only == False
- return request['ACTUAL_URL']
- request.getURL = getURL
-
def switch_on(view, request_layer=z3c.form.interfaces.IFormLayer):
"""Fix up the request and apply the given layer. This is mainly useful
in Zope < 2.10 when using a wrapper layout view.
@@ -103,9 +74,3 @@
interface.alsoProvides(request, IFixedUpRequest)
interface.alsoProvides(request, request_layer)
-
- if getattr(request, 'locale', None) is None:
- request.locale = setup_locale(request)
-
- if not hasattr(request, 'getURL'):
- add_getURL(request)
Modified: plone.z3cform/trunk/setup.py
===================================================================
--- plone.z3cform/trunk/setup.py 2012-05-20 15:26:10 UTC (rev 126405)
+++ plone.z3cform/trunk/setup.py 2012-05-20 19:28:21 UTC (rev 126406)
@@ -38,7 +38,6 @@
'zope.i18n>=3.4',
'zope.browserpage',
'zope.component',
- 'collective.monkeypatcher',
],
extras_require={
'test': ['lxml',
More information about the checkins
mailing list