[Zope3-checkins] CVS: Zope3/src/zope/app/renderer -
configure.zcml:1.9 vocabulary.py:1.8
Stephan Richter
srichter at cosmos.phy.tufts.edu
Sat Apr 24 19:19:53 EDT 2004
Update of /cvs-repository/Zope3/src/zope/app/renderer
In directory cvs.zope.org:/tmp/cvs-serv30290/src/zope/app/renderer
Modified Files:
configure.zcml vocabulary.py
Log Message:
Make use of new widget code to simplify specific implementation.
=== Zope3/src/zope/app/renderer/configure.zcml 1.8 => 1.9 ===
--- Zope3/src/zope/app/renderer/configure.zcml:1.8 Tue Mar 9 07:38:44 2004
+++ Zope3/src/zope/app/renderer/configure.zcml Sat Apr 24 19:19:52 2004
@@ -61,4 +61,15 @@
class=".rest.ReStructuredTextToHTMLRenderer"
permission="zope.Public" />
+ <!-- Special widget for Choice fields with ISourceType vocabularies -->
+
+ <view
+ type="zope.publisher.interfaces.browser.IBrowserRequest"
+ for="zope.schema.interfaces.IChoice
+ .vocabulary.ISourceTypeVocabulary"
+ provides="zope.app.form.interfaces.IInputWidget"
+ factory=".vocabulary.SourceTypeEditWidget"
+ permission="zope.Public"
+ />
+
</configure>
=== Zope3/src/zope/app/renderer/vocabulary.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/renderer/vocabulary.py:1.7 Sun Apr 11 14:16:26 2004
+++ Zope3/src/zope/app/renderer/vocabulary.py Sat Apr 24 19:19:52 2004
@@ -23,9 +23,12 @@
from zope.component.interfaces import IFactory
from zope.app import zapi
-from zope.app.form.browser.vocabularywidget import DropdownListWidget
+from zope.app.form.browser import DropdownWidget
from zope.app.renderer.interfaces import ISource
+class ISourceTypeVocabulary(IVocabulary, IVocabularyTokenized):
+ """Marker interface, so we can register a special widget for it."""
+
class SourceTypeTerm:
implements(ITokenizedTerm)
@@ -66,13 +69,7 @@
return self.getTerm(token)
-class SourceTypeEditWidget(DropdownListWidget):
-
- def __init__(self, field, request):
- self.request = request
- registry = getVocabularyRegistry()
- self.vocabulary = registry.get(field, "SourceTypes")
- self.setField(field)
+class SourceTypeEditWidget(DropdownWidget):
def textForValue(self, term):
return term.title
More information about the Zope3-Checkins
mailing list