Skip to content

Commit

Permalink
Merge pull request #34 from plone/plone-base-overhault
Browse files Browse the repository at this point in the history
Plone base overhault
  • Loading branch information
pbauer authored May 3, 2022
2 parents 195f3e0 + 84ad838 commit 7c5f17b
Show file tree
Hide file tree
Showing 13 changed files with 954 additions and 1,079 deletions.
2 changes: 2 additions & 0 deletions news/34.breaking
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Use plone.base. Remove six and Archetypes specific code.
[jensens]
3 changes: 1 addition & 2 deletions plone/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# -*- coding: utf-8 -*-
__import__('pkg_resources').declare_namespace(__name__)
__import__("pkg_resources").declare_namespace(__name__)
3 changes: 1 addition & 2 deletions plone/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# -*- coding: utf-8 -*-
__import__('pkg_resources').declare_namespace(__name__)
__import__("pkg_resources").declare_namespace(__name__)
3 changes: 1 addition & 2 deletions plone/app/contentmenu/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
from zope.i18nmessageid import MessageFactory


PloneMessageFactory = MessageFactory('plone')
PloneMessageFactory = MessageFactory("plone")
11 changes: 4 additions & 7 deletions plone/app/contentmenu/displayviewsmenu.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from plone.app.contentmenu.interfaces import IDisplayViewsMenu
from zope.browsermenu.menu import BrowserMenu
from zope.component import getAdapters
Expand All @@ -7,19 +6,17 @@

@implementer(IDisplayViewsMenu)
class DisplayViewsMenu(BrowserMenu):

def getMenuItemByAction(self, context, request, action):
# Normalize actions; strip view prefix
if action.startswith('@@'):
if action.startswith("@@"):
action = action[2:]
if action.startswith('++view++'):
if action.startswith("++view++"):
action = action[8:]

for name, item in getAdapters((context, request),
self.getMenuItemType()):
for name, item in getAdapters((context, request), self.getMenuItemType()):
item_action = item.action
# Normalize menu item action; never uses ++view++
if item_action.startswith('@@'):
if item_action.startswith("@@"):
item_action = item_action[2:]

if item_action == action:
Expand Down
20 changes: 7 additions & 13 deletions plone/app/contentmenu/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from zope.browsermenu.interfaces import IBrowserMenu
from zope.browsermenu.interfaces import IBrowserSubMenuItem
from zope.browsermenu.interfaces import IMenuItemType
Expand All @@ -14,8 +13,7 @@ class IContentMenuView(IContentProvider):
"""

def available():
"""Determine whether the menu should be displayed at all.
"""
"""Determine whether the menu should be displayed at all."""

def menu():
"""Create a list of dicts that can be used to render a menu.
Expand All @@ -25,6 +23,7 @@ def menu():
submenu
"""


# The content menu itself - menu items are registered as adapters to this
# interface (this is signalled by marking the interface itself with the
# IInterface IMenuItemType)
Expand Down Expand Up @@ -57,8 +56,7 @@ class IContentMenuItem(Interface):


class IActionsSubMenuItem(IBrowserSubMenuItem):
"""The menu item linking to the actions menu.
"""
"""The menu item linking to the actions menu."""


class IActionsMenu(IBrowserMenu):
Expand All @@ -69,8 +67,7 @@ class IActionsMenu(IBrowserMenu):


class IDisplaySubMenuItem(IBrowserSubMenuItem):
"""The menu item linking to the display menu.
"""
"""The menu item linking to the display menu."""

def disabled(self):
"""Find out if the menu is visible but disabled."""
Expand All @@ -84,8 +81,7 @@ class IDisplayMenu(IBrowserMenu):


class IFactoriesSubMenuItem(IBrowserSubMenuItem):
"""The menu item linking to the factories menu.
"""
"""The menu item linking to the factories menu."""


class IFactoriesMenu(IBrowserMenu):
Expand All @@ -97,8 +93,7 @@ class IFactoriesMenu(IBrowserMenu):


class IWorkflowSubMenuItem(IBrowserSubMenuItem):
"""The menu item linking to the workflow menu.
"""
"""The menu item linking to the workflow menu."""


class IWorkflowMenu(IBrowserMenu):
Expand All @@ -110,8 +105,7 @@ class IWorkflowMenu(IBrowserMenu):


class IPortletManagerSubMenuItem(IBrowserSubMenuItem):
"""The menu item linking to the portlet manager menu.
"""
"""The menu item linking to the portlet manager menu."""


class IPortletManagerMenu(IBrowserMenu):
Expand Down
Loading

0 comments on commit 7c5f17b

Please sign in to comment.