[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/ComponentArchitecture/Browser - InterfaceWidget.py:1.3 configure.zcml:1.3

Jim Fulton jim@zope.com
Wed, 11 Dec 2002 08:36:06 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/ComponentArchitecture/Browser
In directory cvs.zope.org:/tmp/cvs-serv8536

Modified Files:
	InterfaceWidget.py configure.zcml 
Log Message:
Added an interface display widget and made the default interface
widget name 'edit', to agree with other fields/widgets.


=== Zope3/lib/python/Zope/App/ComponentArchitecture/Browser/InterfaceWidget.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/App/ComponentArchitecture/Browser/InterfaceWidget.py:1.2	Wed Dec  4 04:54:05 2002
+++ Zope3/lib/python/Zope/App/ComponentArchitecture/Browser/InterfaceWidget.py	Wed Dec 11 08:36:05 2002
@@ -17,14 +17,16 @@
 """
 
 from Zope.App.Forms.Views.Browser.IBrowserWidget import IBrowserWidget
-from Zope.App.Forms.Views.Browser.Widget import BrowserWidget
+from Zope.App.Forms.Views.Browser import Widget
 from Zope.ComponentArchitecture import getService
 from Zope.Exceptions import NotFoundError
 from Zope.Schema.Exceptions import ValidationError
 
-class SingleInterfaceWidget(BrowserWidget):    
+class BaseWidget:
 
     def _convert(self, name):
+        if not name:
+            return None
         service = getService(self.context.context, "Interfaces")
         return service.getInterface(name)
 
@@ -33,6 +35,8 @@
             return interface
         return interface.__module__ + '.' + interface.__name__
 
+class SingleInterfaceWidget(BaseWidget, Widget.BrowserWidget):    
+
     def __call__(self):
         search_name = self.name + ".search"
         search_string = self.request.form.get(search_name, '')
@@ -61,3 +65,8 @@
         
         HTML = search_field + select_field
         return HTML
+
+class DisplayWidget(BaseWidget, Widget.DisplayWidget):
+    pass
+
+    


=== Zope3/lib/python/Zope/App/ComponentArchitecture/Browser/configure.zcml 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/App/ComponentArchitecture/Browser/configure.zcml:1.2	Wed Dec  4 04:54:05 2002
+++ Zope3/lib/python/Zope/App/ComponentArchitecture/Browser/configure.zcml	Wed Dec 11 08:36:05 2002
@@ -6,9 +6,13 @@
 <browser:view 
 	factory = ".InterfaceWidget.SingleInterfaceWidget"
 	for = "Zope.App.ComponentArchitecture.InterfaceField.IInterfaceField"
-	name = "single"
-/>
+	name = "edit"
+        />
 
-<browser:defaultView for="Zope.App.ComponentArchitecture.InterfaceField.IInterfaceField" name="single" />
+<browser:view 
+	factory = ".InterfaceWidget.DisplayWidget"
+	for = "Zope.App.ComponentArchitecture.InterfaceField.IInterfaceField"
+	name = "display"
+        />
 
 </zopeConfigure>