[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/ComponentArchitecture/Browser - InterfaceWidget.py:1.4
Jim Fulton
jim@zope.com
Thu, 19 Dec 2002 15:19:36 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/ComponentArchitecture/Browser
In directory cvs.zope.org:/tmp/cvs-serv25031/Browser
Modified Files:
InterfaceWidget.py
Log Message:
date: 2002/12/12 15:12:00; author: jim
- Added an interface directive for registering interfaces directly
- Added a "type" field to interface fields to limit interfaces to
those that extend a type.
- Changed the provideInterface in the global InterfaceService to
accept a false id, in which case it computes the id from the
interface module and name.
- Updated the widget to reflect the changes.
=== Zope3/lib/python/Zope/App/ComponentArchitecture/Browser/InterfaceWidget.py 1.3 => 1.4 ===
--- Zope3/lib/python/Zope/App/ComponentArchitecture/Browser/InterfaceWidget.py:1.3 Wed Dec 11 08:36:05 2002
+++ Zope3/lib/python/Zope/App/ComponentArchitecture/Browser/InterfaceWidget.py Thu Dec 19 15:19:05 2002
@@ -16,6 +16,7 @@
$Id$
"""
+from Interface import Interface
from Zope.App.Forms.Views.Browser.IBrowserWidget import IBrowserWidget
from Zope.App.Forms.Views.Browser import Widget
from Zope.ComponentArchitecture import getService
@@ -41,8 +42,12 @@
search_name = self.name + ".search"
search_string = self.request.form.get(search_name, '')
- service = getService(self.context.context, "Interfaces")
- interfaces = list(service.searchInterface(search_string))
+ field = self.context
+ service = getService(field.context, "Interfaces")
+ base = field.type
+ if base == Interface:
+ base=None
+ interfaces = list(service.searchInterface(search_string, base=base))
interfaces.sort()
interfaces = map(self._unconvert, interfaces)