Ignore:
Timestamp:
12 Mar 2012, 15:31:57 (13 years ago)
Author:
Henrik Bettermann
Message:

Set the interface and the factory name of child objects of applicants containers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/container.py

    r7811 r7847  
    2323from zope.component.factory import Factory
    2424from zope.component.interfaces import IFactory
     25from waeup.kofa.interfaces import MessageFactory as _
    2526from waeup.kofa.applicants.interfaces import (
    2627    IApplicantsContainer, IApplicantsContainerAdd,
     
    4950    #: The title of this container as displayed in add-forms. It should
    5051    #: give some idea about what kind of container this is (one or two words)
    51     container_title = u'Basic'
    52 
    53     #: Another 'class-attribute'. Do not fiddle around with it in instances
    54     #: of this class.
    55     #:
     52    container_title = _(u'Basic')
    5653    #: The `container_description` gives a short explanation about for what
    5754    #: purposes this container type serves (a few words only).
    58     container_description = u'handles basic applicants'
     55    container_description = _(u'handles basic applicants')
     56    #: `iface` is the interface of the child objects.
     57    iface = IApplicant
     58    #: The name of the child object factory. This name is used in views
     59    #: to create proper applicant objects.
     60    factory_name = 'waeup.Applicant'
    5961
    6062    @property
     
    9799        """Add an applicant.
    98100        """
    99         if not IApplicant.providedBy(applicant):
     101        if not self.iface.providedBy(applicant):
    100102            raise TypeError(
    101                 'ApplicantsContainers contain only IApplicant instances')
     103                '%s containers contain only %s instances' %(
     104                self.container_title, self.iface))
    102105        applicant_id = generate_applicant_id(container=self)
    103106        applicant.applicant_id = applicant_id
Note: See TracChangeset for help on using the changeset viewer.