[Zope3-checkins] CVS: Zope3/src/zope/app/schema - vocabulary.py:1.6

Gary Poster gary at zope.com
Thu Mar 4 13:48:22 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/schema
In directory cvs.zope.org:/tmp/cvs-serv21253

Modified Files:
	vocabulary.py 
Log Message:
reverting part of Stephan's checkin.  Without this glue code, vocabularies in Zope will never be found.  If you'd like to revisit the glue code, that's fine, but we need the behavior.



=== Zope3/src/zope/app/schema/vocabulary.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/schema/vocabulary.py:1.5	Wed Mar  3 17:54:27 2004
+++ Zope3/src/zope/app/schema/vocabulary.py	Thu Mar  4 13:48:21 2004
@@ -18,6 +18,8 @@
 from zope.app import zapi
 from zope.interface import Interface, implements
 from zope.schema.interfaces import IVocabularyRegistry
+from zope.schema import vocabulary
+from zope.testing import cleanup
 
 
 class IVocabularyFactory(Interface):
@@ -38,3 +40,17 @@
         """See zope.schema.interfaces.IVocabularyRegistry"""
         factory = zapi.getUtility(context, IVocabularyFactory, name)
         return factory(context)
+
+def _clear():
+    """Re-initialize the vocabulary service."""
+    # This should normally only be needed by the testing framework,
+    # but is also used for module initialization.
+    global vocabularyService
+    vocabulary._clear()
+    vocabularyService = vocabulary.getVocabularyRegistry()
+    vocabulary._clear()
+    vocabulary.setVocabularyRegistry(ZopeVocabularyRegistry())
+
+
+_clear()
+cleanup.addCleanUp(_clear)




More information about the Zope3-Checkins mailing list