/usr/share/pyshared/zope/sendmail/vocabulary.py is in python-zope.sendmail 3.7.4-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | ##############################################################################
#
# 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 vocabularies
$Id: vocabulary.py 98165 2009-03-16 21:56:33Z nadako $
"""
__docformat__ = 'restructuredtext'
import zope.component
from zope.interface import directlyProvides
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
from zope.sendmail.interfaces import IMailDelivery
def MailDeliveryNames(context=None):
"""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
"""
utils = zope.component.getUtilitiesFor(IMailDelivery, context)
terms = [SimpleTerm(name) for name, util in utils]
return SimpleVocabulary(terms)
directlyProvides(MailDeliveryNames, IVocabularyFactory)
|