[Zope3-checkins] CVS: Zope3/src/zope/app/utility - vocabulary.py:1.5
Garrett Smith
garrett at mojave-corp.com
Fri May 7 20:20:46 EDT 2004
Update of /cvs-repository/Zope3/src/zope/app/utility
In directory cvs.zope.org:/tmp/cvs-serv1524/src/zope/app/utility
Modified Files:
vocabulary.py
Log Message:
Whitespace fix.
=== Zope3/src/zope/app/utility/vocabulary.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/utility/vocabulary.py:1.4 Fri May 7 20:12:17 2004
+++ Zope3/src/zope/app/utility/vocabulary.py Fri May 7 20:20:45 2004
@@ -13,7 +13,7 @@
##############################################################################
"""Utility Vocabulary.
-This vocabulary provides terms for all utilities providing a given interface.
+This vocabulary provides terms for all utilities providing a given interface.
$Id$
"""
@@ -126,7 +126,7 @@
False
We can also create a lazy iterator. Note that the utility terms might
- appear in a different order than the utilities were registered.
+ appear in a different order than the utilities were registered.
>>> iterator = iter(vocab)
>>> terms = list(iterator)
@@ -187,7 +187,7 @@
Sometimes it is desirable to only select the name of a utility. For
this purpose a 'nameOnly' argument was added to the constructor, in which
case the UtilityTerm's value is not the utility itself but the name of the
- utility.
+ utility.
>>> vocab = UtilityVocabulary(None, IObject, nameOnly=True)
>>> pprint.pprint([term.value for term in vocab])
@@ -199,12 +199,12 @@
def __init__(self, context, interface, nameOnly=False):
if nameOnly is not False:
nameOnly = True
- if isinstance(interface, (str, unicode)):
+ if isinstance(interface, (str, unicode)):
interface = zapi.getUtility(context, IInterface, interface)
utils = zapi.getUtilitiesFor(context, interface)
self._terms = dict([(name, UtilityTerm(nameOnly and name or util, name))
for name, util in utils])
-
+
def __contains__(self, value):
"""See zope.schema.interfaces.IBaseVocabulary"""
return value in [term.value for term in self._terms.values()]
@@ -235,12 +235,12 @@
def __len__(self):
"""See zope.schema.interfaces.IIterableVocabulary"""
return len(self._terms)
-
+
class UtilityComponentInterfacesVocabulary(ObjectInterfacesVocabulary):
-
+
def __init__(self, context):
if IUtilityRegistration.providedBy(context):
context = context.getComponent()
super(UtilityComponentInterfacesVocabulary, self).__init__(
- context)
\ No newline at end of file
+ context)
More information about the Zope3-Checkins
mailing list