On Fri, Nov 14, 2008 at 7:23 PM, Hanno Schlichting [EMAIL PROTECTED] wrote:
Log message for revision 92953:
Copied over the UtilityTerm and UtilityVocabulary implementation from
zope.app.component to avoid a dependency.
Instead of duplicating the code there should be a zope.utilityvocabulary
package that both zope.sendmail and zope.app.component can use.
Changed:
U zope.sendmail/trunk/CHANGES.txt
U zope.sendmail/trunk/buildout.cfg
U zope.sendmail/trunk/setup.py
D zope.sendmail/trunk/src/zope/sendmail/DEPENDENCIES.cfg
U zope.sendmail/trunk/src/zope/sendmail/vocabulary.py
-=-
Modified: zope.sendmail/trunk/CHANGES.txt
===
--- zope.sendmail/trunk/CHANGES.txt 2008-11-14 23:08:44 UTC (rev 92952)
+++ zope.sendmail/trunk/CHANGES.txt 2008-11-15 00:23:04 UTC (rev 92953)
@@ -4,6 +4,9 @@
3.5.1 (unreleased)
--
+- Copied over the UtilityTerm and UtilityVocabulary implementation from
+ zope.app.component to avoid a dependency.
+
- work around a problem when smtp quit fails, the mail was considered not
delivered where just the quit failed
Modified: zope.sendmail/trunk/buildout.cfg
===
--- zope.sendmail/trunk/buildout.cfg2008-11-14 23:08:44 UTC (rev 92952)
+++ zope.sendmail/trunk/buildout.cfg2008-11-15 00:23:04 UTC (rev 92953)
@@ -2,8 +2,6 @@
develop = .
parts = test coverage-test coverage-report
-find-links = http://download.zope.org/distribution/
-
[test]
recipe = zc.recipe.testrunner
eggs = zope.sendmail
Modified: zope.sendmail/trunk/setup.py
===
--- zope.sendmail/trunk/setup.py2008-11-14 23:08:44 UTC (rev 92952)
+++ zope.sendmail/trunk/setup.py2008-11-15 00:23:04 UTC (rev 92953)
@@ -43,7 +43,6 @@
'zope.interface',
'zope.schema',
'zope.security',
-'zope.app.component',
],
include_package_data = True,
zip_safe = False,
Deleted: zope.sendmail/trunk/src/zope/sendmail/DEPENDENCIES.cfg
===
--- zope.sendmail/trunk/src/zope/sendmail/DEPENDENCIES.cfg 2008-11-14
23:08:44 UTC (rev 92952)
+++ zope.sendmail/trunk/src/zope/sendmail/DEPENDENCIES.cfg 2008-11-15
00:23:04 UTC (rev 92953)
@@ -1,9 +0,0 @@
-transaction
-# zope.app for UtilityVocabulary
-zope.app
-zope.component
-zope.configuration
-zope.i18nmessageid
-zope.interface
-zope.schema
-zope.security
Modified: zope.sendmail/trunk/src/zope/sendmail/vocabulary.py
===
--- zope.sendmail/trunk/src/zope/sendmail/vocabulary.py 2008-11-14 23:08:44
UTC (rev 92952)
+++ zope.sendmail/trunk/src/zope/sendmail/vocabulary.py 2008-11-15 00:23:04
UTC (rev 92953)
@@ -17,11 +17,155 @@
__docformat__ = 'restructuredtext'
+import zope.component
from zope.interface import classProvides
+from zope.interface import implements
+from zope.interface import Interface
+from zope.schema.interfaces import ITokenizedTerm
from zope.schema.interfaces import IVocabularyFactory
+from zope.schema.interfaces import IVocabularyTokenized
from zope.sendmail.interfaces import IMailDelivery
-from zope.app.component.vocabulary import UtilityVocabulary
+
+class UtilityTerm(object):
+A term representing a utility.
+
+The token of the term is the name of the utility. Here is a brief example
+on how the IVocabulary interface is handled in this term as a
+utility:
+
+ from zope.interface.verify import verifyObject
+ from zope.schema.interfaces import IVocabulary
+ term = UtilityTerm(IVocabulary, 'zope.schema.interfaces.IVocabulary')
+ verifyObject(ITokenizedTerm, term)
+True
+
+ term.value
+InterfaceClass zope.schema.interfaces.IVocabulary
+ term.token
+'zope.schema.interfaces.IVocabulary'
+
+ term
+UtilityTerm zope.schema.interfaces.IVocabulary, instance of
InterfaceClass
+
+implements(ITokenizedTerm)
+
+def __init__(self, value, token):
+Create a term for value and token.
+self.value = value
+self.token = token
+
+def __repr__(self):
+return 'UtilityTerm %s, instance of %s' %(
+self.token, self.value.__class__.__name__)
+
+
+class UtilityVocabulary(object):
+Vocabulary that provides utilities of a specified interface.
+
+Here is a short example of how the vocabulary should work.
+
+First we need to create a utility interface and some utilities:
+
+ class IObject(Interface):
+... 'Simple interface to mark object utilities.'
+
+ class Object(object):
+... implements(IObject)
+... def