Skip to content

Commit

Permalink
Merge pull request #58 from plone/gforcada-use-zope-decorators
Browse files Browse the repository at this point in the history
Use zope.interface decorator
  • Loading branch information
gforcada authored Jul 10, 2016
2 parents 0bd6f1f + de0ce6f commit 989f2ce
Show file tree
Hide file tree
Showing 33 changed files with 103 additions and 141 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ New features:

Bug fixes:

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


1.11.0 (2016-05-15)
Expand Down
5 changes: 2 additions & 3 deletions Products/Archetypes/ArchetypeTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from DateTime import DateTime
from StringIO import StringIO

from zope.interface import implements
from zope.interface import implementer

from Products.Archetypes import PloneMessageFactory as _
from Products.Archetypes.interfaces import IArchetypeTool
Expand Down Expand Up @@ -438,15 +438,14 @@ def __call__(self):
last_load = DateTime()


@implementer(IArchetypeTool)
class ArchetypeTool(UniqueObject, ActionProviderBase,
SQLStorageConfig, Folder):
"""Archetypes tool, manage aspects of Archetype instances.
"""
id = TOOL_NAME
meta_type = TOOL_NAME.title().replace('_', ' ')

implements(IArchetypeTool)

isPrincipiaFolderish = True # Show up in the ZMI

security = ClassSecurityInfo()
Expand Down
5 changes: 2 additions & 3 deletions Products/Archetypes/BaseBTreeFolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from Products.CMFCore.CMFBTreeFolder import CMFBTreeFolder
from AccessControl import ClassSecurityInfo
from App.class_init import InitializeClass
from zope.interface import implements
from zope.interface import implementer

# to keep backward compatibility
has_btree = 1
Expand All @@ -22,13 +22,12 @@ class BaseBTreeFolder(Base):
_ordering = 'unordered' # old large folder remain unordered at first


@implementer(IBaseFolder)
class ObsoleteBaseBTreeFolder(CMFBTreeFolder, BaseFolder):
""" A BaseBTreeFolder with all the bells and whistles"""

security = ClassSecurityInfo()

implements(IBaseFolder)

# Fix permissions set by CopySupport.py
__ac_permissions__ = (
(permissions.ModifyPortalContent,
Expand Down
8 changes: 3 additions & 5 deletions Products/Archetypes/BaseContent.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from Products.CMFCore.PortalContent import PortalContent
from OFS.PropertyManager import PropertyManager

from zope.interface import implements
from zope.interface import implementer

CONTENT_MANAGE_OPTIONS = (
{'action': 'manage_change_history_page', 'label': 'History'},
Expand All @@ -22,15 +22,14 @@
)


@implementer(IBaseContent, IReferenceable)
class BaseContentMixin(CatalogMultiplex,
BaseObject,
PortalContent,
Historical):
"""A not-so-basic CMF Content implementation that doesn't
include Dublin Core Metadata"""

implements(IBaseContent, IReferenceable)

security = ClassSecurityInfo()
manage_options = CONTENT_MANAGE_OPTIONS

Expand Down Expand Up @@ -75,14 +74,13 @@ def _notifyOfCopyTo(self, container, op=0):
InitializeClass(BaseContentMixin)


@implementer(IBaseContent, IReferenceable, IExtensibleMetadata)
class BaseContent(BaseContentMixin,
ExtensibleMetadata,
PropertyManager):
"""A not-so-basic CMF Content implementation with Dublin Core
Metadata included"""

implements(IBaseContent, IReferenceable, IExtensibleMetadata)

schema = BaseContentMixin.schema + ExtensibleMetadata.schema

def __init__(self, oid, **kwargs):
Expand Down
10 changes: 4 additions & 6 deletions Products/Archetypes/BaseFolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from Products.CMFCore.utils import _checkPermission

from zope import event
from zope.interface import implements
from zope.interface import implementer

FOLDER_MANAGE_OPTIONS = (
{'action': 'manage_main', 'label': 'Contents'},
Expand All @@ -27,15 +27,14 @@
)


@implementer(IBaseFolder, IBaseObject, IReferenceable, IContentish)
class BaseFolderMixin(CatalogMultiplex,
BaseObject,
PortalFolder,
):
"""A not-so-basic Folder implementation, with no Dublin Core
Metadata"""

implements(IBaseFolder, IBaseObject, IReferenceable, IContentish)

security = ClassSecurityInfo()

# Fix permissions set by CopySupport.py
Expand Down Expand Up @@ -245,13 +244,12 @@ def manage_afterMKCOL(self, id, result, REQUEST=None, RESPONSE=None):
InitializeClass(BaseFolderMixin)


@implementer(IBaseFolder, IBaseObject, IReferenceable,
IContentish, IExtensibleMetadata)
class BaseFolder(BaseFolderMixin, ExtensibleMetadata):
"""A not-so-basic Folder implementation, with Dublin Core
Metadata included"""

implements(IBaseFolder, IBaseObject, IReferenceable,
IContentish, IExtensibleMetadata)

schema = BaseFolderMixin.schema + ExtensibleMetadata.schema

security = ClassSecurityInfo()
Expand Down
5 changes: 2 additions & 3 deletions Products/Archetypes/BaseObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
from webdav.NullResource import NullResource

from zope import event
from zope.interface import implements, Interface
from zope.interface import implementer, Interface
from zope.component import subscribers
from zope.component import queryMultiAdapter
from zope.component import queryUtility
Expand Down Expand Up @@ -111,6 +111,7 @@
), marshall=RFC822Marshaller())


@implementer(IBaseObject, IReferenceable)
class BaseObject(Referenceable):

security = ClassSecurityInfo()
Expand All @@ -130,8 +131,6 @@ class BaseObject(Referenceable):

_at_rename_after_creation = False # rename object according to title?

implements(IBaseObject, IReferenceable)

def __init__(self, oid, **kwargs):
self.id = oid

Expand Down
4 changes: 2 additions & 2 deletions Products/Archetypes/BaseUnit.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os.path
from zope.interface import implements
from zope.interface import implementer

from Products.Archetypes.interfaces import IBaseUnit
from Products.Archetypes.log import log
Expand All @@ -17,8 +17,8 @@
_marker = []


@implementer(IBaseUnit, IWriteLock)
class BaseUnit(File):
implements(IBaseUnit, IWriteLock)

isUnit = 1
mimetype = None
Expand Down
5 changes: 2 additions & 3 deletions Products/Archetypes/ExtensibleMetadata.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import string
from logging import DEBUG
from zope.component import queryUtility
from zope.interface import implements
from zope.interface import implementer

from Products.Archetypes import PloneMessageFactory as _
from Products.Archetypes.Field import BooleanField, LinesField, TextField, \
Expand Down Expand Up @@ -45,12 +45,11 @@


# MIXIN
@implementer(IExtensibleMetadata)
class ExtensibleMetadata(Persistence.Persistent):
""" A DC metadata implementation for Plone Archetypes
"""

implements(IExtensibleMetadata)

security = ClassSecurityInfo()

schema = type = MetadataSchema((
Expand Down
Loading

0 comments on commit 989f2ce

Please sign in to comment.