[Zope3-checkins] CVS: Zope3/src/zope/app/browser - managementviewselector.py:1.1.2.1 menu.py:1.1.2.1 absoluteurl.py:1.1.2.4 configure.zcml:1.1.2.5 objectname.py:1.1.2.4

Jim Fulton jim@zope.com
Wed, 25 Dec 2002 08:27:50 -0500


Update of /cvs-repository/Zope3/src/zope/app/browser
In directory cvs.zope.org:/tmp/cvs-serv9989/src/zope/app/browser

Modified Files:
      Tag: NameGeddon-branch
	absoluteurl.py configure.zcml objectname.py 
Added Files:
      Tag: NameGeddon-branch
	managementviewselector.py menu.py 
Log Message:
Gor zope running again! 

I haven't tested everything. 
(Yes, we need functional tests. Maybe this week).

Good enough to merge into trunk.



=== Added File Zope3/src/zope/app/browser/managementviewselector.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.
#
##############################################################################
"""
$Id: managementviewselector.py,v 1.1.2.1 2002/12/25 13:27:19 jim Exp $
"""

__metaclass__ = type

from zope.component import getService
from zope.publisher.browser import BrowserView
from zope.publisher.interfaces.browser import IBrowserPublisher

class ManagementViewSelector(BrowserView):
    """View that selects the first available management view
    """

    __implements__ = BrowserView.__implements__, IBrowserPublisher

    def browserDefault(self, request):
        return self, ()

    def __call__(self):
        context = self.context
        request = self.request
        browser_menu_service = getService(context, 'BrowserMenu')
        item = browser_menu_service.getFirstMenuItem(
            'zmi_views', context, request)
        if item:
            request.response.redirect(item['action'])
            return u''

        request.response.redirect('.') # Redirect to content/
        return u''


__doc__ = ManagementViewSelector.__doc__ + __doc__


=== Added File Zope3/src/zope/app/browser/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.
#
##############################################################################
"""
$Id: menu.py,v 1.1.2.1 2002/12/25 13:27:19 jim Exp $
"""

from zope.publisher.browser import BrowserView
from zope.app.interfaces.browser.menu import IMenuAccessView
from zope.component import getService

class MenuAccessView(BrowserView):
    __doc__ = IMenuAccessView.__doc__

    __implements__ = BrowserView.__implements__, IMenuAccessView

    def __getitem__(self, menu_id):
        context = self.context
        request = self.request
        browser_menu_service = getService(context, 'BrowserMenu')
        return browser_menu_service.getMenu(menu_id,
                                            self.context,
                                            self.request)


__doc__ = MenuAccessView.__doc__ + __doc__


=== Zope3/src/zope/app/browser/absoluteurl.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/browser/absoluteurl.py:1.1.2.3	Tue Dec 24 21:20:10 2002
+++ Zope3/src/zope/app/browser/absoluteurl.py	Wed Dec 25 08:27:19 2002
@@ -20,29 +20,6 @@
 from zope.proxy.context import getWrapperContainer, getInnerWrapperData
 from zope.component import getView
 
-from zope.interface import Interface
-
-class IAbsoluteURL(Interface):
-
-    def __str__():
-        """Get a human-readable string representation
-        """
-
-    def __repr__():
-        """Get a string representation
-        """
-
-    def __call__():
-        """Get a string representation
-        """
-
-    def breadcrumbs():
-        """Return a tuple like ({'name':name, 'url':url}, ...)
-
-        Name is the name to display for that segment of the breadcrumbs.
-        URL is the link for that segment of the breadcrumbs.
-        """
-
 class AbsoluteURL(BrowserView):
 
     def __str__(self):


=== Zope3/src/zope/app/browser/configure.zcml 1.1.2.4 => 1.1.2.5 ===
--- Zope3/src/zope/app/browser/configure.zcml:1.1.2.4	Tue Dec 24 21:22:48 2002
+++ Zope3/src/zope/app/browser/configure.zcml	Wed Dec 25 08:27:19 2002
@@ -1,77 +1,147 @@
 <zopeConfigure 
-    xmlns='http://namespaces.zope.org/zope'
-    xmlns:browser='http://namespaces.zope.org/browser'>
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:browser="http://namespaces.zope.org/browser">
 
-<include package=".skins" />
+<!-- Foundational setup -->
+
+  <!-- The default default view -->
+  <browser:defaultView name="index.html" />
+
+
+  <!-- Standard menus -->
+
+    <browser:menu 
+       id="zmi_views" 
+       title="Menu for displaying alternate representations of an object"
+       />
+
+    <browser:menu
+       id="zmi_actions" 
+       title="Menu for displaying actions to be performed"
+       />
+
+   <browser:menu
+        id="add_content"
+        title="Menu of objects to be added to content folders"
+        />
+
+   <browser:menu
+        id="add_component"
+        title="Menu of objects to be added to service manager packages"
+        />
+
+   <browser:menu id="add_configuration"
+        title="Menu of addable configuration objects"
+        />
+
+
+  <!-- Management view selector -->
+  <!-- Get first accessable item from zmi_views menu -->
+  <browser:view
+     name="SelectedManagementView.html"
+     permission="zope.Public"
+     factory=".managementviewselector.ManagementViewSelector" 
+     allowed_interface="zope.publisher.interfaces.browser.IBrowserPublisher"
+     allowed_attributes="__call__"
+     />
+
+  <!-- Menu access -->
+  <browser:view
+     name="view_get_menu"
+     permission="zope.Public"
+     factory=".menu.MenuAccessView" 
+     allowed_interface="zope.app.interfaces.browser.menu.IMenuAccessView"
+     />
+
+<!-- includes -->
+
+<include package=".applicationcontrol" />
+<include package=".cache" />
+<include package=".component" />
+<include package=".container" />
+<include package=".content" />
+<include package=".dublincore" />
+<include package=".form" />
+<include package=".security" />
 <include package=".services" />
+<include package=".skins" />
 
-<browser:defaultView
-    name="classBrowser.html"
-    for = "zope.interface.Interface"
-    permission="zope.View"
-    template="IBrowser.pt"
-    factory="zope.app.browser.introspector.IntrospectorView"
-    />
+<!-- Introspection -->
 
-<browser:menuItem 
-    for = "zope.interface.Interface" 
-    title="Introspector" 
-    menu="zmi_views" 
-    action="classBrowser.html"/>
- 
-
-<browser:defaultView
-    name="interfaceBrowser.html"
-    for="zope.interface.interfaces.IInterface"
-    permission="zope.View"
-    template="IBrowser.pt"
-    factory="zope.app.browser.introspector.IntrospectorView"
-    /> 
+  <browser:defaultView
+      name="classBrowser.html"
+      for = "zope.interface.Interface"
+      permission="zope.View"
+      template="ibrowser.pt"
+      factory="zope.app.browser.introspector.IntrospectorView"
+      />
+
+  <browser:menuItem 
+      for = "zope.interface.Interface" 
+      title="Introspector" 
+      menu="zmi_views" 
+      action="classBrowser.html"
+      />
 
-<browser:view
-    name="zope.app.rdb.GadflyDA"
-    for="zope.app.interfaces.container.IAdding"
-    factory="zope.app.browser.gadflyda.GadflyDAAddView"
-    permission="zope.ManageServices">
-
-  <browser:page name="+" attribute="add" />
-  <browser:page name="action.html" attribute="action" />
-</browser:view>
-
-<browser:menuItem menu="add_component"
-    for="zope.app.interfaces.container.IAdding"
-    title="Gadfly DA" 
-    action="zope.app.rdb.GadflyDA"
-    description="A Gadfly Database Adapter"/>
+
+  <browser:defaultView
+      name="interfaceBrowser.html"
+      for="zope.interface.interfaces.IInterface"
+      permission="zope.View"
+      template="ibrowser.pt"
+      factory="zope.app.browser.introspector.IntrospectorView"
+      /> 
+
+<!-- Gadfly DA -->
+
+  <browser:view
+      name="zope.app.rdb.GadflyDA"
+      for="zope.app.interfaces.container.IAdding"
+      factory="zope.app.browser.gadflyda.GadflyDAAddView"
+      permission="zope.ManageServices">
+
+    <browser:page name="+" attribute="add" />
+    <browser:page name="action.html" attribute="action" />
+
+    </browser:view>
+
+  <browser:menuItem menu="add_component"
+      for="zope.app.interfaces.container.IAdding"
+      title="Gadfly DA" 
+      action="zope.app.rdb.GadflyDA"
+      description="A Gadfly Database Adapter"/>
 
 <!-- ZopeDatabaseAdapter default views -->
 
   <browser:defaultView for="zope.app.interfaces.rdb.IZopeDatabaseAdapter"
       name="editForm.html" />
 
-  <browser:menuItems menu="zmi_views" for="zope.app.interfaces.rdb.IZopeDatabaseAdapter">
+  <browser:menuItems menu="zmi_views"
+         for="zope.app.interfaces.rdb.IZopeDatabaseAdapter">
     <browser:menuItem title="Edit" action="editForm.html"/>
     <browser:menuItem title="Test" action="testForm.html"/>
-  </browser:menuItems>
+    </browser:menuItems>
 
   <browser:view
       for="zope.app.interfaces.rdb.IZopeDatabaseAdapter"
       permission="zope.View"
       factory="zope.app.browser.rdb.Connection">
     <browser:page name="editForm.html"
-        template="Browser/connection.pt" />
+        template="connection.pt" />
     <browser:page name="edit.html" attribute="edit" />
     <browser:page name="connect.html" attribute="connect" />
     <browser:page name="disconnect.html" attribute="disconnect" />
-  </browser:view>
+  
+    </browser:view>
 
   <browser:view
       for="zope.app.interfaces.rdb.IZopeDatabaseAdapter"
       permission="zope.View"
       factory="zope.app.browser.rdb.TestSQL">
-    <browser:page name="testForm.html" template="Browser/testSQL.pt" />
-    <browser:page name="test.html" template="Browser/testResults.pt" />
-  </browser:view>
+    <browser:page name="testForm.html" template="testsql.pt" />
+    <browser:page name="test.html" template="testresults.pt" />
+
+    </browser:view>
 
 <!-- Undo -->
 
@@ -83,5 +153,36 @@
      <browser:page name="undo.html" attribute="action" />
      </browser:view>
 
+<!-- URLs and names -->
+
+<browser:view
+    name="absolute_url"
+    factory=".absoluteurl.AbsoluteURL"
+    permission="zope.Public"
+    allowed_interface="zope.app.interfaces.browser.absoluteurl.IAbsoluteURL" 
+    />
+
+<browser:view
+    for="zope.app.interfaces.content.folder.IRootFolder"
+    name="absolute_url"
+    factory=".absoluteurl.SiteAbsoluteURL"
+    permission="zope.Public"
+    allowed_interface="zope.app.interfaces.browser.absoluteurl.IAbsoluteURL" 
+    />
+
+<browser:view
+    name="object_name"
+    factory=".objectname.ObjectNameView"
+    permission="zope.Public"
+    allowed_interface="zope.app.interfaces.traversing.objectname.IObjectName" 
+    />
+
+<browser:view
+    for="zope.app.interfaces.content.folder.IRootFolder"
+    name="object_name"
+    factory=".objectname.SiteObjectNameView"
+    permission="zope.Public"
+    allowed_interface="zope.app.interfaces.traversing.objectname.IObjectName" 
+    />
 
 </zopeConfigure>


=== Zope3/src/zope/app/browser/objectname.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/browser/objectname.py:1.1.2.3	Tue Dec 24 21:20:10 2002
+++ Zope3/src/zope/app/browser/objectname.py	Wed Dec 25 08:27:19 2002
@@ -21,8 +21,6 @@
 from zope.app.traversing.objectname \
     import IObjectName, ObjectName, SiteObjectName
 
-from zope.interface import Interface
-
 class ObjectNameView(ObjectName):
 
     __implements__ = IBrowserView, IObjectName