[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services/utility - __init__.py:1.9

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Aug 15 21:45:09 EDT 2003


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

Modified Files:
	__init__.py 
Log Message:
Merging dreamcatcher's TTW Schema branch:

1. Fixed Bug in adding that would cause infinite loops when the menu items
   action was not a valif view or factory id.

2. Extended adding to support more complex views. Until now we only 
   supported constructions like "+/AddView=id". Now you are able to say
   "+/AddView/More=id", which means that more information can be carried 
   in the URL. This can be used in many ways, including multi-page adding
   wizards. In my case I needed it to pass in the type of the TTW Schema-
   based Content Component.

3. Added Local Menus. This was a pain in the butt, but I think I got a 
   fairly nice model, where you can create local Menu Services, and Menus
   are simply named utilities. When active they are menus in the menu 
   service. This is very similar to the local interface service and TTW 
   Schema. 

4. Made some modifications to TTW Schema, cleaned up the code and moved
   the browser code and interfaces to the places they belong.

5. Added a Content Component Definition utility component, which takes a
   Schema and creates a content component for it, including permission
   settings and a menu entry. Currently the menu entry is always made to
   a local 'add_content' menu. I will change this and make it actually a
   screen, where the menu and title of the menu item can be chosen by the
   developer. Mmmh, should I add a factory for the definition as well, so
   that the content component is also available via python?

6. Added a Content Component Instance component that represents an 
   instance od a Content Component Definition. You will never directly 
   encounter this component, since it is automatically used by the adding
   code of the Content Component Definition.

7. Cleanups by both dreamcatcher and myself.

That's it. For more details see the branch checkin messages. I now consider
the dreamcatcher-ttwschema-branch closed.


=== Zope3/src/zope/app/browser/services/utility/__init__.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/browser/services/utility/__init__.py:1.8	Thu Aug  7 13:41:39 2003
+++ Zope3/src/zope/app/browser/services/utility/__init__.py	Fri Aug 15 20:43:05 2003
@@ -2,7 +2,7 @@
 #
 # Copyright (c) 2003 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
@@ -25,7 +25,7 @@
 from zope.app import zapi
 from zope.interface import providedBy
 from zope.proxy import removeAllProxies
-
+from zope.app.introspector import interfaceToName
 
 class UtilityInterfaceWidget(InterfaceWidget):
     """Custom widget to select an interface from the component's interfaces.
@@ -37,11 +37,11 @@
         result = ['\n<select name="%s">' % self.name]
         for interface in providedBy(component).flattened():
             result.append('  <option value="%s.%s">%s</option>' %
-                          (interface.__module__, interface.__name__,
-                           interface.__name__))
+                          (interface.__module__, interface.getName(),
+                           interface.getName()))
         result.append('</select>')
         return '\n'.join(result)
-        
+
 
 class AddRegistration(AddComponentRegistration):
     """View for adding a utility registration.
@@ -172,7 +172,7 @@
             active = obj = cr.active()
             if obj is None:
                 obj = cr.info()[0]['registration'] # Pick a representative
-            ifname = _interface_name(iface)
+            ifname = interfaceToName(self.context, iface)
             d = {"interface": ifname,
                  "name": name,
                  "url": "",
@@ -199,7 +199,3 @@
         form = zapi.getView(regstack, "ChangeRegistrations", self.request)
         form.update()
         return form
-
-
-def _interface_name(iface):
-    return "%s.%s" % (iface.__module__, iface.__name__)




More information about the Zope3-Checkins mailing list