Skip to content

Commit

Permalink
Merge pull request #4 from zopefoundation/fix-deprectations
Browse files Browse the repository at this point in the history
Clarify supported Zope versions + fix deprecation warnings.
  • Loading branch information
Michael Howitz committed Apr 5, 2018
2 parents 8df4fa9 + d5e762d commit 5868d3e
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 22 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ parts

__pycache__
.installed.cfg
.mr.developer.cfg
*.dll
*.pyc
*.pyo
Expand Down
6 changes: 4 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
CHANGES
=======

1.1.1 (unreleased)
------------------
2.0 (unreleased)
----------------

- Drop support for Zope versions older than 4.0

- Fix test to work with Zope 4, where ``makeClassForTemplate`` was removed and replaced with ``SimpleViewClass``.
[thet]
Expand Down
2 changes: 1 addition & 1 deletion buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extensions = mr.developer
parts = test
develop = .

auto-checkout = Zope2
auto-checkout =

[sources]
Zope2 = git git://github.com/zopefoundation/Zope.git
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from setuptools import setup

__version__ = '1.1.1.dev0'
__version__ = '2.0.dev0'

setup(
name='five.customerize',
Expand All @@ -25,7 +25,7 @@
keywords='zope views templates customization ttw',
author='Zope Foundation and Contributors',
author_email='zope-dev@zope.org',
url='https://pypi.python.org/pypi/five.customerize',
url='https://github.com/zopefoundation/five.customerize',
license='ZPL 2.1',
packages=['five', 'five.customerize'],
package_dir={'': 'src'},
Expand All @@ -46,7 +46,7 @@
'zope.traversing',
'zope.viewlet',
'Acquisition',
'Zope2',
'Zope',
],
extras_require={
'test': [
Expand All @@ -59,7 +59,7 @@
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Zope2',
'Framework :: Zope :: 4',
'License :: OSI Approved :: Zope Public License',
'Operating System :: OS Independent',
'Programming Language :: Python',
Expand Down
4 changes: 2 additions & 2 deletions src/five/customerize/customerize.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ change the template to give us some info output:
In order to be able to look up the customized view now, we need to
make the site the current site:

>>> from zope.site.hooks import setSite
>>> from zope.component.hooks import setSite
>>> setSite(site)

The newly registered adapter has an explicit security check that
Expand Down Expand Up @@ -226,7 +226,7 @@ available to the customized local view. We create one of these views
... except ImportError:
... from Products.Five.security import getSecurityInfo, protectClass

>>> from App.class_init import InitializeClass
>>> from AccessControl.class_init import InitializeClass
>>> viewclass = None
>>> if makeClassForTemplate:
... cdict = getSecurityInfo(TestView)
Expand Down
10 changes: 2 additions & 8 deletions src/five/customerize/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,8 @@
from zope.traversing.adapters import DefaultTraversable
from zope.publisher.browser import BrowserLanguages
from zope.publisher.http import HTTPCharsets
from zope.site.hooks import setHooks

# BBB Zope 2.12
try:
from Zope2.App.zcml import load_config
load_config # pyflakes
except ImportError:
from Products.Five.zcml import load_config
from zope.component.hooks import setHooks
from Zope2.App.zcml import load_config


def setUp(test):
Expand Down
9 changes: 4 additions & 5 deletions src/five/customerize/zpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
from zope.lifecycleevent.interfaces import IObjectRemovedEvent
from zope.viewlet.interfaces import IViewlet, IViewletManager
from zope.interface import implements
from zope.interface import implementer

from five.customerize.interfaces import ITTWViewTemplate
from five.customerize.utils import checkPermission
from plone.portlets.interfaces import IPortletRenderer
from plone.portlets.interfaces import IPortletManager


@implementer(ITTWViewTemplate)
class TTWViewTemplate(ZopePageTemplate):
"""A template class used to generate Zope 3 views TTW"""
implements(ITTWViewTemplate)

manage_options = (
ZopePageTemplate.manage_options[0],
Expand Down Expand Up @@ -115,9 +115,9 @@ def __parent__(self):
return self.context


@implementer(IViewlet)
class TTWViewletRenderer(object):
""" analogon to TTWViewTemplateRenderer for viewlets """
implements(IViewlet)

__allow_access_to_unprotected_subobjects__ = True

Expand Down Expand Up @@ -175,9 +175,9 @@ def __of__(self, obj):
return self


@implementer(IPortletRenderer)
class TTWPortletRenderer(object):
""" analogon to TTWViewletRenderer for portlets """
implements(IPortletRenderer)

__allow_access_to_unprotected_subobjects__ = True

Expand Down Expand Up @@ -248,4 +248,3 @@ def unregisterViewWhenZPTIsDeleted(zpt, event):
components.unregisterAdapter(reg.factory, reg.required,
reg.provided, reg.name)
break

0 comments on commit 5868d3e

Please sign in to comment.