Skip to content

Commit

Permalink
Use zope.interface decorator
Browse files Browse the repository at this point in the history
This not only makes code more pleasent to read,
but also makes the code python 3 compatible
(while maintaining python 2 compatibility).
  • Loading branch information
gforcada committed Jul 5, 2016
1 parent b8c9557 commit b25ed37
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ New:

Fixes:

- *add item here*
- Use zope.interface decorator.
[gforcada]


3.0.18 (2016-02-25)
Expand Down
4 changes: 2 additions & 2 deletions plone/protect/authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from Products.Five import BrowserView
from zExceptions import Forbidden
from zope.component import getUtility
from zope.interface import implements
from zope.interface import implementer
from ZPublisher.HTTPRequest import HTTPRequest

import hmac
Expand Down Expand Up @@ -93,8 +93,8 @@ def createToken(extra='', manager=None):
return hmac.new(secret, user + extra, sha).hexdigest()


@implementer(IAuthenticatorView)
class AuthenticatorView(BrowserView):
implements(IAuthenticatorView)

def token(self, extra=''):
return createToken(extra)
Expand Down
5 changes: 2 additions & 3 deletions plone/protect/auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from zope.component import ComponentLookupError
from zope.component import adapts
from zope.component import getUtility
from zope.interface import implements, Interface
from zope.interface import implementer, Interface
from zope.globalrequest import getRequest

try:
Expand All @@ -46,14 +46,13 @@
('true', 't', 'yes', 'y', '1')


@implementer(ITransform)
class ProtectTransform(object):
"""
XXX Need to be extremely careful with everything we do in here
since an error here would mean the transform is skipped
and no CSRF protection...
"""

implements(ITransform)
adapts(Interface, Interface) # any context, any request

# should be last lxml related transform
Expand Down
5 changes: 3 additions & 2 deletions plone/protect/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from plone.protect.interfaces import IConfirmView
from Products.Five import BrowserView
from zope.interface import implements
from zope.interface import implementer


@implementer(IConfirmView)
class ConfirmView(BrowserView):
implements(IConfirmView)
pass

0 comments on commit b25ed37

Please sign in to comment.