Skip to content

Commit

Permalink
Use class decorators to be compatible with Python 3.
Browse files Browse the repository at this point in the history
  • Loading branch information
sallner committed Sep 30, 2016
1 parent 754f638 commit be6ff2b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/grokcore/view/ftests/static/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
from zope.traversing.browser.interfaces import IAbsoluteURL


@zope.interface.implementer(ITraversable, IAbsoluteURL)
class DummyResource(object):
""" Dummy resource implementation. """
zope.interface.implements(ITraversable, IAbsoluteURL)

def __init__(self, request, name=''):
self.request = request
Expand Down
11 changes: 6 additions & 5 deletions src/grokcore/view/templatereg.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ Our templates are ``.template``, so we need to register a
appropriate templates::

>>> from grokcore.view.interfaces import ITemplateFileFactory, ITemplate
>>> from zope.interface import implements
>>> class TestTemplate(object):
... implements(ITemplate) # we lie for testing purposes
>>> from zope.interface import implementer
>>> @implementer(ITemplate) # we lie for testing purposes
... class TestTemplate(object):
... def __init__(self, filename, source):
... self.filename = filename
... self.source = source
Expand All @@ -48,8 +48,9 @@ appropriate templates::
... def _annotateGrokInfo(self, template_name, template_path):
... pass # XXX why do we need to implement this?

>>> class TestTemplateFactory(object):
... implements(ITemplateFileFactory)
>>> @implementer(ITemplateFileFactory) # we lie for testing purposes
... class TestTemplateFactory(object):
... implementer(ITemplateFileFactory)
... def __call__(self, filename, _prefix=None):
... f = open(os.path.join(_prefix, filename), 'r')
... data = f.read()
Expand Down

0 comments on commit be6ff2b

Please sign in to comment.