[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces/services - menu.py:1.1.2.1 menu.pyc:1.1.2.1

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu Aug 14 14:58:07 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/interfaces/services
In directory cvs.zope.org:/tmp/cvs-serv10819/app/interfaces/services

Added Files:
      Tag: dreamcatcher-ttwschema-branch
	menu.py menu.pyc 
Log Message:
Checkpoint check-in for people following the branch:

Got Local Browser Menu Service to work. I used a similar model to the 
interface service, where the service uses registered Browser Menu utilities
to get its menu entries.

There are also a bunch of policy-type decisions that come with local menus.
One is whether a local menu should overwrite or complement existing menus.
Currently I have an 'inherit' flag that can be set. If true, the local menu
will add to the existing entries, otherwise it will overwrite them. Note 
that this does not solve all use cases, such as if you want to take over
just a few entries, but I called YAGNI on it (someone else can do it, if it
is necessary).

I added and extended interfaces for all of this to work. I tried really 
hard to avoid rewriting the getMenu() methof for the local menu service 
version and I think I got it. ;-)

I also have a nice Overview screen for the Local Menu Service, which shows
you all available menus.

To Do:

  - Flesh out the interfaces and implement missing methods.

  - Clean up the code.

  - Fix tests.

  - Write a bunch of new tests.




=== Added File Zope3/src/zope/app/interfaces/services/menu.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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.
#
##############################################################################
"""Locale Menu Service interfaces

$Id: menu.py,v 1.1.2.1 2003/08/14 17:58:02 srichter Exp $
"""
from zope.schema import Bool
from zope.app.component.interfacefield import InterfaceField
from zope.app.i18n import ZopeMessageIDFactory as _
from zope.app.interfaces.publisher.browser import \
     IBrowserMenu, IBrowserMenuService
from zope.app.interfaces.services.registration import \
     IComponentRegistration, ComponentPath

class ILocalBrowserMenu(IBrowserMenu):
    """A local menu. Local menus can inherit menu entries from menus with the
    same name that are higher up the chain."""

    inherit = Bool(
        title=u"Inherit Items",
        description=u"If true, this menu will inherit menu items from menus"
                    u"higher up.",
        default=True,
        required=True)


class ILocalBrowserMenuService(IBrowserMenuService):

    def getAllLocalMenus():
        pass

    def getLocalMenu(menu_id):
        pass

    def queryLocalMenu(menu_id, default=None):
        pass

    def getInheritedMenu(menu_id, canBeLocal=False):
        pass

    def queryInheritedMenu(menu_id, canBeLocal=False):
        pass




=== Added File Zope3/src/zope/app/interfaces/services/menu.pyc ===
  <Binary-ish file>



More information about the Zope3-Checkins mailing list