[Zope3-checkins] SVN: Zope3/branches/3.3/src/zope/sendmail/ When I converted vocabulary ZCML directives to utility ZCML directives

Philipp von Weitershausen philikon at philikon.de
Sat Aug 12 13:34:33 EDT 2006


Log message for revision 69430:
  When I converted vocabulary ZCML directives to utility ZCML directives
  + a definition of the vocabulary in Python, I must have fallen asleep
  over this one: it was missing the interface descriminator and the nameOnly
  flag. Fixed and tested.
  

Changed:
  A   Zope3/branches/3.3/src/zope/sendmail/tests/test_vocabulary.py
  U   Zope3/branches/3.3/src/zope/sendmail/vocabulary.py

-=-
Added: Zope3/branches/3.3/src/zope/sendmail/tests/test_vocabulary.py
===================================================================
--- Zope3/branches/3.3/src/zope/sendmail/tests/test_vocabulary.py	2006-08-12 14:30:59 UTC (rev 69429)
+++ Zope3/branches/3.3/src/zope/sendmail/tests/test_vocabulary.py	2006-08-12 17:34:33 UTC (rev 69430)
@@ -0,0 +1,29 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Mail delivery names vocabulary test
+
+$Id$
+"""
+import unittest
+from zope.testing.doctestunit import DocTestSuite
+from zope.component.testing import setUp, tearDown
+
+def test_suite():
+    return unittest.TestSuite([
+        DocTestSuite('zope.sendmail.vocabulary',
+                     setUp=setUp, tearDown=tearDown),
+        ])
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: Zope3/branches/3.3/src/zope/sendmail/tests/test_vocabulary.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: Zope3/branches/3.3/src/zope/sendmail/vocabulary.py
===================================================================
--- Zope3/branches/3.3/src/zope/sendmail/vocabulary.py	2006-08-12 14:30:59 UTC (rev 69429)
+++ Zope3/branches/3.3/src/zope/sendmail/vocabulary.py	2006-08-12 17:34:33 UTC (rev 69430)
@@ -19,7 +19,35 @@
 
 from zope.interface import classProvides
 from zope.schema.interfaces import IVocabularyFactory
+from zope.sendmail.interfaces import IMailDelivery
 from zope.app.component.vocabulary import UtilityVocabulary
 
 class MailDeliveryNames(UtilityVocabulary):
+    """Vocabulary with names of mail delivery utilities
+
+    Let's provide a few stub utilities:
+
+      >>> from zope.interface import implements
+      >>> class StubMailDelivery(object):
+      ...     implements(IMailDelivery)
+
+      >>> from zope.component import provideUtility
+      >>> for name in 'and now for something completely different'.split():
+      ...     provideUtility(StubMailDelivery(), name=name)
+
+    Let's also provide another utility to verify that we only see mail
+    delivery utilities:
+
+      >>> provideUtility(MailDeliveryNames, name='Mail Delivery Names')
+
+    Let's see what's in the vocabulary:
+
+      >>> vocabulary = MailDeliveryNames(None)
+      >>> names = [term.value for term in vocabulary]
+      >>> names.sort()
+      >>> print ' '.join(names)
+      and completely different for now something
+    """
     classProvides(IVocabularyFactory)
+    interface = IMailDelivery
+    nameOnly = True



More information about the Zope3-Checkins mailing list