Skip to content

Commit

Permalink
whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Lotze committed Dec 9, 2010
1 parent 7c954ac commit afc9717
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -16,9 +16,11 @@
import os
from setuptools import setup, find_packages


def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()


setup(name='zope.componentvocabulary',
version='1.0.2dev',
author='Zope Foundation and Contributors',
Expand Down Expand Up @@ -60,4 +62,3 @@ def read(*rnames):
include_package_data=True,
zip_safe=False,
)

30 changes: 15 additions & 15 deletions src/zope/componentvocabulary/configure.zcml
@@ -1,25 +1,25 @@
<configure xmlns="http://namespaces.zope.org/zope">

<!-- the 'Interfaces' vocabulary below requires a registred IInterface -->
<interface
interface="zope.interface.interfaces.IInterface"
/>
<!-- Vocabularies -->
<utility
component=".vocabulary.InterfacesVocabulary"
name="Interfaces"
/>
<!-- the 'Interfaces' vocabulary below requires a registred IInterface -->
<interface
interface="zope.interface.interfaces.IInterface"
/>

<!-- Vocabularies -->
<utility
component=".vocabulary.InterfacesVocabulary"
name="Interfaces"
/>

<utility
component=".vocabulary.ObjectInterfacesVocabulary"
name="Object Interfaces"
/>
<utility
component=".vocabulary.UtilityComponentInterfacesVocabulary"
provides="zope.schema.interfaces.IVocabularyFactory"
name="Utility Component Interfaces"

<utility
component=".vocabulary.UtilityComponentInterfacesVocabulary"
provides="zope.schema.interfaces.IVocabularyFactory"
name="Utility Component Interfaces"
/>

</configure>
6 changes: 5 additions & 1 deletion src/zope/componentvocabulary/vocabulary.py
Expand Up @@ -30,13 +30,14 @@

from zope.componentvocabulary.i18n import ZopeMessageFactory as _


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')
Expand Down Expand Up @@ -229,10 +230,12 @@ def __len__(self):
"""See zope.schema.interfaces.IIterableVocabulary"""
return len(self._terms)


class InterfacesVocabulary(UtilityVocabulary):
classProvides(IVocabularyFactory)
interface = IInterface


class ObjectInterfacesVocabulary(SimpleVocabulary):
"""A vocabulary that provides a list of all interfaces that its context
provides.
Expand Down Expand Up @@ -271,6 +274,7 @@ def __init__(self, context):
for interface in interfaces]
super(ObjectInterfacesVocabulary, self).__init__(terms)


class UtilityComponentInterfacesVocabulary(ObjectInterfacesVocabulary):
classProvides(IVocabularyFactory)

Expand Down

0 comments on commit afc9717

Please sign in to comment.