Re: [Zope-dev] [Checkins] SVN: zope.sendmail/trunk/ Copied over the UtilityTerm and UtilityVocabulary implementation from zope.app.component to avoid a dependency.

2008-11-15 Thread Benji York
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 

Re: [Zope-dev] [Checkins] SVN: zope.sendmail/trunk/ Copied over the UtilityTerm and UtilityVocabulary implementation from zope.app.component to avoid a dependency.

2008-11-15 Thread Hanno Schlichting
Benji York wrote:
 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.

I agree in principal. In this case the code is extremely tiny, though.

I'm not sure if packages which consist of only two simple classes are
really that much of a good idea. There is an overhead in tracking
dependencies and maintaining packages in itself. When the benefit of
being able to reuse the same code outweighs this overhead is not clear
to me.

Hanno

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [Checkins] SVN: zope.sendmail/trunk/ Copied over the UtilityTerm and UtilityVocabulary implementation from zope.app.component to avoid a dependency.

2008-11-15 Thread Philipp von Weitershausen
Hanno Schlichting wrote:
 Benji York wrote:
 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.
 
 I agree in principal. In this case the code is extremely tiny, though.
 
 I'm not sure if packages which consist of only two simple classes are
 really that much of a good idea. There is an overhead in tracking
 dependencies and maintaining packages in itself. When the benefit of
 being able to reuse the same code outweighs this overhead is not clear
 to me.

If it's tiny, then the overhead is there only once, when the package is 
created and released, right? After than you can just leave it alone and 
never ever have to think about it again.

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [Checkins] SVN: zope.sendmail/trunk/ Copied over the UtilityTerm and UtilityVocabulary implementation from zope.app.component to avoid a dependency.

2008-11-15 Thread Stephan Richter
On Saturday 15 November 2008, Benji York wrote:
 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.

+1. I was going to write a message to that effect as well. The danger of 
having diverging code is larger.

Regards,
Stephan
-- 
Stephan Richter
Web Software Design, Development and Training
Google me. Zope Stephan Richter
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )