[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - vocabularywidget.py:1.47
Stephan Richter
srichter@cosmos.phy.tufts.edu
Tue, 22 Jul 2003 00:25:31 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv415/src/zope/app/browser/form
Modified Files:
vocabularywidget.py
Log Message:
okay, I actually hooked up the vocabulary directive and registry, so that
we can do actual useful things with vocabularies.
I also had to fix a call that could not be run due to a context wrapper, so
I had to remove all proxies, which is probably not the right thing to do.
Fred, could you look at this?
Finally, it seems that I am the first one that seriously plays with
vocabularies, since it is impossible that vocabularies are usable as they
were before this checkin. Furthermore, many parts of the framework are in
a sorry state; for example the widget for the IVocabularyField requires
really an implementation of ITokenizedVocabularyField and ITokenizedTerm.
Why? This beats the heck out of me.
I really thought that after so many people told me they studied
vocabularies and that I should have a look, that they also wrote some semi-
serious code in it. But this cannot have been the case. I think studying
means "I read the docs." in this case.
Vocabularies are definitely not in a ready state for the first beta and
need to be added to the to do. (I will do that, as soon as I have the bug
tracker setup.)
Finally, I will check in some code tomorrow, which demonstrates how
vocabularies work, in one of the most common use cases (in my opinion).
=== Zope3/src/zope/app/browser/form/vocabularywidget.py 1.46 => 1.47 ===
--- Zope3/src/zope/app/browser/form/vocabularywidget.py:1.46 Wed Jun 25 17:18:52 2003
+++ Zope3/src/zope/app/browser/form/vocabularywidget.py Tue Jul 22 00:25:27 2003
@@ -86,6 +86,11 @@
def _get_vocabulary_widget(field, request, viewname):
view = getView(field.vocabulary, "field-%s-widget" % viewname, request)
+ # XXX: The hack of the century. After all ZCML attempts via ZCML failed,
+ # this is the only way I could find to make it work! (SR)
+ # Fred, please have a look at this.
+ from zope.proxy import removeAllProxies
+ view = removeAllProxies(view)
view.setField(field)
return view