Skip to content

Commit

Permalink
Fix test to work with Zope 4, where makeClassForTemplate was removed …
Browse files Browse the repository at this point in the history
…and replaced with SimpleViewClass.
  • Loading branch information
thet committed Sep 7, 2016
1 parent cebce7d commit 292069e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ CHANGES
1.1.1 (unreleased)
------------------

- Nothing changed yet.
- Fix test to work with Zope 4, where ``makeClassForTemplate`` was removed and replaced with ``SimpleViewClass``.
[thet]


1.1 (2012-08-30)
Expand Down
29 changes: 24 additions & 5 deletions src/five/customerize/customerize.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,13 @@ available to the customized local view. We create one of these views
... __name__ = 'mystaticview.html'
... def foo_method(self):
... return 'baz'
>>> from Products.Five.browser.metaconfigure import makeClassForTemplate

>>> try:
... from Products.Five.browser.metaconfigure import makeClassForTemplate
... except ImportError:
... makeClassForTemplate = None
... from Products.Five.browser.metaconfigure import SimpleViewClass


# BBB Zope 2.12
>>> try:
Expand All @@ -224,10 +230,23 @@ available to the customized local view. We create one of these views
... from Products.Five.security import getSecurityInfo, protectClass

>>> from App.class_init import InitializeClass
>>> cdict = getSecurityInfo(TestView)
>>> cdict['__name__'] = 'simpleview.html'
>>> viewclass = makeClassForTemplate('testviewtemplate.pt', globals=globals(),
... bases=(TestView,), cdict=cdict, name='simpleview.html')
>>> viewclass = None
>>> if makeClassForTemplate:
... cdict = getSecurityInfo(TestView)
... cdict['__name__'] = 'simpleview.html'
... viewclass = makeClassForTemplate(
... 'testviewtemplate.pt',
... globals=globals(),
... bases=(TestView,),
... cdict=cdict,
... name='simpleview.html'
... )
... else:
... viewclass = SimpleViewClass(
... 'testviewtemplate.pt',
... bases=(TestView,),
... name='simpleview.html'
... )
>>> protectClass(viewclass, 'zope.Public')
>>> InitializeClass(viewclass)
>>> from zope.component import provideAdapter
Expand Down

0 comments on commit 292069e

Please sign in to comment.