[z3-checkins] r21741 - z3/CMFonFive/trunk
regebro at codespeak.net
regebro at codespeak.net
Fri Jan 6 16:08:17 CET 2006
Author: regebro
Date: Fri Jan 6 16:08:14 2006
New Revision: 21741
Removed:
z3/CMFonFive/trunk/five_template.pt
z3/CMFonFive/trunk/globalbrowsermenuservice.py
z3/CMFonFive/trunk/interfaces.py
Modified:
z3/CMFonFive/trunk/CHANGES.txt
z3/CMFonFive/trunk/README.txt
z3/CMFonFive/trunk/__init__.py
z3/CMFonFive/trunk/configure.zcml
z3/CMFonFive/trunk/fiveactionstool.py
z3/CMFonFive/trunk/meta.zcml
Log:
Zope 3.2 support + cleanup.
Modified: z3/CMFonFive/trunk/CHANGES.txt
==============================================================================
--- z3/CMFonFive/trunk/CHANGES.txt (original)
+++ z3/CMFonFive/trunk/CHANGES.txt Fri Jan 6 16:08:14 2006
@@ -1,11 +1,41 @@
CMFonFive Product Changelog
- CMFonFive 1.2.0 (2005/07/22)
+ CMFonFive 1.3.0 (2006-01-05)
+
+ - The five_template support was removed as it provided little extra
+ functionality compared to the support that already exists in CMFDefault.
+ Note that this will create some compatibility issues:
+
+ 1. The five_template is no longer configured for all interfaces, but
+ only for IDynamicType. If your class do not implement IDynamicType,
+ you can add a directlyProvides statement for the class in the
+ configure.zcml.
+
+ 2. The CMFDefault template does not include support for the "head"-slot.
+
+ 3. What CMFonFive calls css_clot, is by CMFDefault called style_slot.
+
+ - interfaces.py is no longer used and was removed.
+
+ - The menuItem support is replaced by an implementation that supports
+ Zope 3.2 (and therefore Zope 2.9). Zope 3.0 and Zope 2.8 is no longer
+ supported.
+
+
+ CMFonFive 1.2.1 (2006-01-02)
+
+ - Menu titles was converted to strings even if they were messageIDs.
+
+ - Spelling fixes.
+
+ - metadirectives.py is not used and was removed.
+
+ CMFonFive 1.2.0 (2005-07-22)
- CMF 1.5.2 moves the interface bridging into CMF itself, so it it
removed from CMFonFive.
- CMFonFive 1.1.0 (2005/06/19)
+ CMFonFive 1.1.0 (2005-06-19)
- A new ZCML directive has been added: cmf:menuItem. This works
as browser:menuItem, except that the filter parameter will be
@@ -15,13 +45,13 @@
- The five_template has some errors giving templates double <html>-tags.
- CMFonFive 1.0.1 (2005/06/01)
+ CMFonFive 1.0.1 (2005-06-01)
- configure.zcml: Provided an i18n translation domain, 'CMFonFive'.
- permissions.py: Use newer permission imports from CMF 1.5,
if available (fall back to 1.4 spellings).
- CMFonFive 1.0.0 (2005/04/01)
+ CMFonFive 1.0.0 (2005-04-01)
- Initial release.
Modified: z3/CMFonFive/trunk/README.txt
==============================================================================
--- z3/CMFonFive/trunk/README.txt (original)
+++ z3/CMFonFive/trunk/README.txt Fri Jan 6 16:08:14 2006
@@ -2,52 +2,66 @@
=========
CMFonFive is a product that provides integration between CMF and Five,
-making it possible to write Five products that run on CMF.
+making it possible to write Five products that run on CMF.
* http://www.zope.org/Products/CMF/
* http://codespeak.net/z3/five/
-CMFonFive has three main parts:
+CMFonFive used to have three main parts, but two of these have now been
+integrated into CMF itself:
* A set of interface definitions and bridges for many parts of CMF.
- (This part has been moved to CMF itself in CMF 1.5.2).
+ This part has been moved to CMF itself in CMF 1.5.2.
* A skin layer that provides integration between the Zope3 standard macros
- and the CMF main template. (This also exists in CMF 1.5.2, but the
- CMFonFive version provides support for more slots.)
+ and the CMF main template.
+ This part has been moved to CMF itself in CMF 1.5.2.
* A Five Actions Tool, that enables you to display the Zope 3 menuItems
as CMF actions. Any menuItem registered will be accessible though the
portal_actions tool, where the menu the item was registered for will be
used as the action category.
-
Requirements
------------
-* Five 1.1 or 1.2b
+* Zope 2.7 or later.
+
+* If you use Zope 2.7 you also need Five 1.0 or 1.1.
* CMF 1.4 or 1.5.
Download
--------
-Make sure you match your CMF version and your CMFonFive version!
+Which version you should download depends on the version of Zope and CMF.
+Make sure you match these versions with your CMFonFive version!
+Note that there is no CMFonFive for CMF versions before 1.5.2 on Zope 2.9.
+
+* CMFonFive 1.3.0 (2006-01-05)
+
+ For CMF 1.5.2 and later, with Zope 2.9.
+
+ http://codespeak.net/z3/cmfonfive/release/CMFonFive-1.3.0.tgz
* CMFonFive 1.2.1 (2006-01-02)
- This is the version to use for CMF 1.5.2 and later.
+ For CMF 1.5.2 and later, with Zope 2.8.
http://codespeak.net/z3/cmfonfive/release/CMFonFive-1.2.1.tgz
* CMFonFive 1.1.1 (2006-01-02)
- This is the version to use for CMF 1.4, 1.5.0 and 1.5.1.
+ For CMF 1.4.0 to 1.5.1 with Zope 2.7 or 2.8.
http://codespeak.net/z3/cmfonfive/release/CMFonFive-1.1.1.tgz
-These earlier versions are deprecated, as later version have had bugs fixed.
+
+Earlier versions
+----------------
+
+These earlier versions are depracated, as later version have had bugs fixed.
* CMFonFive 1.2.0 (2005-07-22)
Modified: z3/CMFonFive/trunk/__init__.py
==============================================================================
--- z3/CMFonFive/trunk/__init__.py (original)
+++ z3/CMFonFive/trunk/__init__.py Fri Jan 6 16:08:14 2006
@@ -11,7 +11,7 @@
$Id$
"""
from Products.CMFCore.utils import ToolInit
-import fiveactionstool, interfaces
+import fiveactionstool
def initialize(context):
Modified: z3/CMFonFive/trunk/configure.zcml
==============================================================================
--- z3/CMFonFive/trunk/configure.zcml (original)
+++ z3/CMFonFive/trunk/configure.zcml Fri Jan 6 16:08:14 2006
@@ -1,33 +1,11 @@
<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:five="http://namespaces.zope.org/five"
xmlns:browser="http://namespaces.zope.org/browser"
- i18n_domain="CMFonFive"
>
- <!-- Set up default menues as action categories. -->
+ <!-- Set up standard action categories as menus -->
<browser:menu
id="object"
title="Object menu"
/>
- <browser:layer
- name="cmf"
- />
- <browser:skin
- name="cmf"
- layers="cmf default"
- />
- <browser:defaultSkin
- name="cmf"
- />
-
- <browser:page
- for="*"
- template="five_template.pt"
- name="five_template"
- permission="zope.Public"
- layer="cmf"
- />
-
</configure>
Deleted: /z3/CMFonFive/trunk/five_template.pt
==============================================================================
--- /z3/CMFonFive/trunk/five_template.pt Fri Jan 6 16:08:14 2006
+++ (empty file)
@@ -1,15 +0,0 @@
-<metal:block define-macro="page"><metal:block use-macro="here/main_template/macros/master">
- <metal:block fill-slot="base">
- <metal:block define-slot="base" />
- </metal:block>
- <metal:block fill-slot="header">
- <metal:block define-slot="header" />
- </metal:block>
- <metal:block fill-slot="css_slot">
- <metal:block define-slot="style_slot" />
- </metal:block>
- <metal:block fill-slot="main">
- <metal:block define-slot="body" />
- </metal:block>
-</metal:block>
-</metal:block>
Modified: z3/CMFonFive/trunk/fiveactionstool.py
==============================================================================
--- z3/CMFonFive/trunk/fiveactionstool.py (original)
+++ z3/CMFonFive/trunk/fiveactionstool.py Fri Jan 6 16:08:14 2006
@@ -21,9 +21,13 @@
from Products.CMFCore.Expression import Expression
from Products.CMFCore.utils import UniqueObject
-from zope.app.publisher.browser.globalbrowsermenuservice import \
- globalBrowserMenuService
-from globalbrowsermenuservice import getMenu
+from zope.app import zapi
+from zope.app.publisher.interfaces.browser import IBrowserMenu
+from zope.app.publisher.browser.menu import getMenu
+
+def _listMenuIds():
+ return [id for id, utility in zapi.getUtilitiesFor(IBrowserMenu)]
+
from Products.Five import security
import zope.thread
@@ -51,9 +55,9 @@
if object is None:
object = info.content
actions = []
- for mid in globalBrowserMenuService._registry.keys():
- menu = getMenu(mid, object, self.REQUEST)
- for entry in menu:
+
+ for menu_id in _listMenuIds():
+ for entry in getMenu(menu_id, object, self.REQUEST):
# The action needs a unique name, so I'll build one
# from the object_id and the action url. That is sure
# to be unique.
@@ -63,19 +67,24 @@
else:
act_id = 'action_%s_%s' % (object.getId(), action)
- if entry['filter'] is None:
+ if entry.get('filter') is None:
filter = None
else:
filter = Expression(text=str(entry['filter']))
+ title = entry['title']
+ # Having bits of unicode here can make rendering very confused.
+ if isinstance(title, unicode):
+ title = str(title)
act = ActionInformation(id=act_id,
- title=str(entry['title']),
+ title=title,
action=Expression(text='string:%s' % action),
condition=filter,
- category=str(mid),
+ category=str(menu_id),
visible=1)
actions.append(act)
- return actions or ()
+
+ return tuple(actions)
InitializeClass( FiveActionsTool )
Deleted: /z3/CMFonFive/trunk/globalbrowsermenuservice.py
==============================================================================
--- /z3/CMFonFive/trunk/globalbrowsermenuservice.py Fri Jan 6 16:08:14 2006
+++ (empty file)
@@ -1,158 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Global Browser Menu Service
-
-$Id: globalbrowsermenuservice.py 27079 2004-08-12 19:45:55Z srichter $
-"""
-from zope.security.interfaces import Unauthorized, Forbidden
-from zope.interface import implementedBy
-from Products.Five.security import checkPermission, CheckerPublic
-from zope.app.publication.browser import PublicationTraverser
-from zope.app.component.interface import provideInterface
-from zope.app.servicenames import BrowserMenu
-
-from zope.app.publisher.browser.globalbrowsermenuservice import globalBrowserMenuService, MenuItem
-
-from zope.interface.interfaces import IInterface
-import types
-
-def addMenuItem(menu_id, interface, action, title,
- description='', filter_string=None, permission=None,
- extra=None,
- ):
- registry = globalBrowserMenuService._registry[menu_id].registry
-
- if permission:
- if permission == 'zope.Public':
- permission = CheckerPublic
-
- if interface is not None and not IInterface.providedBy(interface):
- if isinstance(interface, (type, types.ClassType)):
- interface = implementedBy(interface)
- else:
- raise TypeError(
- "The interface argument must be an interface (or None) "
- "or a class.")
-
- data = registry.get(interface) or []
- data.append(
- MenuItem(action, title, description, filter_string, permission, extra)
- )
- registry.register(interface, data)
-
-
-def getMenu(menu_id, object, request, max=999999):
- traverser = PublicationTraverser()
-
- result = []
- seen = {}
-
- # stuff for figuring out the selected view
- request_url = request.getURL()
-
- for item in globalBrowserMenuService.getAllMenuItems(menu_id, object):
-
- # Make sure we don't repeat a specification for a given title
- title = item.title
- if title in seen:
- continue
- seen[title] = 1
-
- permission = item.permission
- action = item.action
-
- if permission:
- # If we have an explicit permission, check that we
- # can access it.
- if not checkPermission(permission, object):
- continue
-
- elif action:
- # Otherwise, test access by attempting access
- path = action
- l = action.find('?')
- if l >= 0:
- path = action[:l]
- try:
- v = traverser.traverseRelativeURL(
- request, object, path)
- # TODO:
- # tickle the security proxy's checker
- # we're assuming that view pages are callable
- # this is a pretty sound assumption
- v.__call__
- except (Unauthorized, Forbidden):
- continue # Skip unauthorized or forbidden
-
- normalized_action = action
- if action.startswith('@@'):
- normalized_action = action[2:]
-
- if request_url.endswith('/'+normalized_action):
- selected='selected'
- elif request_url.endswith('/++view++'+normalized_action):
- selected='selected'
- elif request_url.endswith('/@@'+normalized_action):
- selected='selected'
- else:
- selected=''
-
- result.append({
- 'title': title,
- 'description': item.description,
- 'action': "%s" % action,
- 'filter': item.filter,
- 'selected': selected,
- 'extra': item.extra,
- })
-
- if len(result) >= max:
- return result
-
- return result
-
-
-
-def menuItemDirective(_context, menu, for_,
- action, title, description='', filter=None,
- permission=None, extra=None):
- return menuItemsDirective(_context, menu, for_).menuItem(
- _context, action, title, description, filter, permission, extra)
-
-
-class menuItemsDirective(object):
-
- def __init__(self, _context, menu, for_):
- self.interface = for_
- self.menu = menu
-
- def menuItem(self, _context, action, title, description='',
- filter=None, permission=None, extra=None):
- _context.action(
- discriminator = ('browser:menuItem',
- self.menu, self.interface, title),
- callable = addMenuItem,
- args = (self.menu, self.interface,
- action, title, description, filter, permission, extra),
- ),
-
- def __call__(self, _context):
- _context.action(
- discriminator = None,
- callable = provideInterface,
- args = (self.interface.__module__+'.'+self.interface.getName(),
- self.interface)
- )
-
-
Deleted: /z3/CMFonFive/trunk/interfaces.py
==============================================================================
--- /z3/CMFonFive/trunk/interfaces.py Fri Jan 6 16:08:14 2006
+++ (empty file)
@@ -1,23 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005 CMFonFive Contributors. All rights reserved.
-#
-# This software is distributed under the terms of the Zope Public
-# License (ZPL) v2.1. See COPYING.txt for more information.
-#
-###########################################################################
-""" Interfaces for the action menu integration
-
-$Id$
-"""
-
-from zope.app.publisher.interfaces.browser import IBrowserMenu
-from zope.schema import TextLine
-
-class IActionMenu(IBrowserMenu):
-
- category = TextLine(
- title=u"Category",
- description=u"The action category of this action menu",
- required=True)
-
Modified: z3/CMFonFive/trunk/meta.zcml
==============================================================================
--- z3/CMFonFive/trunk/meta.zcml (original)
+++ z3/CMFonFive/trunk/meta.zcml Fri Jan 6 16:08:14 2006
@@ -2,23 +2,23 @@
xmlns="http://namespaces.zope.org/zope"
xmlns:meta="http://namespaces.zope.org/meta">
- <meta:directives namespace="http://namespaces.zope.org/cmf">
+ <!-- meta:directives namespace="http://namespaces.zope.org/cmf">
<meta:directive
name="menu"
schema="zope.app.publisher.browser.metadirectives.IMenuDirective"
- handler="zope.app.publisher.browser.globalbrowsermenuservice.menuDirective"
+ handler="zope.app.publisher.browser.menumeta.menuDirective"
/>
<meta:directive
name="menuItem"
- schema="zope.app.publisher.browser.metadirectives.IMenuItemDirective"
+ schema="zope.app.publisher.browser.menumeta.IMenuItemDirective"
handler=".globalbrowsermenuservice.menuItemDirective"
/>
<meta:complexDirective
name="menuItems"
- schema="zope.app.publisher.browser.metadirectives.IMenuItemsDirective"
+ schema="zope.app.publisher.browser.menumeta.IMenuItemsDirective"
handler=".globalbrowsermenuservice.menuItemsDirective"
>
@@ -29,6 +29,6 @@
</meta:complexDirective>
- </meta:directives>
+ </meta:directives /-->
</configure>
More information about the z3-checkins
mailing list