Changeset 354

Show
Ignore:
Timestamp:
09/19/06 12:09:45 (2 years ago)
Author:
mj
Message:

Use a UtilityVocabulary? baseclass instead of a homebrew factory

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • z3wingdbg/trunk/configure.zcml

    r319 r354  
    55<!-- vocabulary --> 
    66<utility 
    7     provides="zope.schema.interfaces.IVocabularyFactory" 
    8     component=".interfaces.getServerTypesVocabulary" 
     7    component=".interfaces.ServerTypesVocabulary" 
    98    name="z3wingdbg.servertypes" 
    109    /> 
  • z3wingdbg/trunk/interfaces.py

    r341 r354  
    55from zope.component.interfaces import IFactory 
    66from zope.i18n import MessageFactory 
     7 
     8from zope.app.component.vocabulary import UtilityVocabulary 
    79 
    810_ = MessageFactory('z3wingdbg') 
     
    292294 
    293295# Vocabularies 
    294 def getServerTypesVocabulary(context): 
    295     """List all available debug server types""" 
    296     types = component.getUtilitiesFor(IDebugServerFactory) 
    297     return schema.vocabulary.SimpleVocabulary.fromValues(t[0] for t in types) 
     296class ServerTypesVocabulary(UtilityVocabulary): 
     297    interface.classProvides(schema.interfaces.IVocabularyFactory) 
     298    interface = IDebugServerFactory 
     299    nameOnly = True