Changeset 6075


Ignore:
Timestamp:
14 May 2011, 00:25:23 (13 years ago)
Author:
uli
Message:

Clean up. Document what happens and avoid empty doc strings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py

    r6073 r6075  
    2727from zc.sourcefactory.basic import BasicSourceFactory
    2828from zope import schema
     29from zope.component import getUtility, getUtilitiesFor
    2930from zope.interface import Interface, Attribute
    3031from zope.pluggableauth.interfaces import IPrincipalInfo
     
    3334from waeup.sirp.image.image import WAeUPImageFile
    3435from waeup.sirp.interfaces import IWAeUPObject, SimpleWAeUPVocabulary
    35 from zope.component import getAllUtilitiesRegisteredFor
     36
    3637
    3738IMAGE_PATH = os.path.join(
     
    8384           
    8485class ApplicantContainerProviderSource(BasicSourceFactory):
    85     """
     86    """A source offering all available applicants container types.
     87
     88    The values returned by this source are names of utilities that can
     89    create :class:`ApplicantContainer` instances. So, if you get a
     90    name like ``'myactype'`` from this source, then you can do:
     91
     92      >>> from zope.component import getUtility
     93      >>> p = getUtility(IApplicantsContainerProvider, name=myactype)
     94      >>> my_applicants_container = p.factory()
     95
     96    Or you can access class-attributes like
     97
     98      >>> my_applicants_container.container_title
     99      'Pretty'
     100   
    86101    """
    87102    def getValues(self):
    88         providers = getAllUtilitiesRegisteredFor(IApplicantsContainerProvider)
    89         return providers                 
     103        """Returns a list of ``(<name>, <provider>)`` tuples.
     104
     105        Here ``<name>`` is the name under which an
     106        :class:``ApplicantContainerProvider`` was registered as a
     107        utility and ``<provider>`` is the utility itself.
     108        """
     109        return getUtilitiesFor(IApplicantsContainerProvider)
    90110
    91111    def getToken(self, value):
    92         return getattr(value, 'grokcore.component.directive.name')
    93        
     112        """Return the name of the ``(<name>, <provider>)`` tuple.
     113        """
     114        return value[0]
     115
    94116    def getTitle(self, value):
    95         return "%s - %s" % (value.factory.title, value.factory.description)           
     117        """Get a 'title - description' string for a container type.
     118        """
     119        factory = value[1].factory
     120        return "%s - %s" % (
     121            factory.container_title, factory.container_description)
    96122
    97123class IResultEntry(IWAeUPObject):
     
    118144    """
    119145
     146    container_title = Attribute(
     147        u'classattribute: title for type of container')
     148    container_description = Attribute(
     149        u'classattribute: description for type of container')
     150
     151   
    120152    code = schema.TextLine(
    121153        title = u'Code',
Note: See TracChangeset for help on using the changeset viewer.