Ignore:
Timestamp:
19 Jun 2015, 15:36:21 (9 years ago)
Author:
Henrik Bettermann
Message:

More adjustments for a proper documentation.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
5 edited

Legend:

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

    r10655 r13077  
    2424from datetime import datetime
    2525import zope.location.location
    26 from zope.component import getUtility
     26from zope.component import getUtility, ComponentLookupError
    2727from zope.component.factory import Factory
    2828from zope.component.interfaces import IFactory
     
    5353    grok.implements(IApplicantsContainer,IApplicantsContainerAdd)
    5454
    55     #: A dictionary to hold per language translations of description string.
    5655    description_dict = {}
    5756
    5857    local_roles = []
    59 
    60     def archive(self, app_ids=None):
    61         """Create on-dist archive of applicants stored in this term.
    62 
    63         If app_ids is `None`, all applicants are archived.
    64 
    65         If app_ids contains a single id string, only the respective
    66         applicants are archived.
    67 
    68         If app_ids contains a list of id strings all of the respective
    69         applicants types are saved to disk.
    70         """
    71         raise NotImplementedError()
    72 
    73     def clear(self, app_ids=None, archive=True):
    74         """Remove applicants of type given by 'id'.
    75 
    76         Optionally archive the applicants.
    77 
    78         If id is `None`, all applicants are archived.
    79 
    80         If id contains a single id string, only the respective
    81         applicants are archived.
    82 
    83         If id contains a list of id strings all of the respective
    84         applicant types are saved to disk.
    85 
    86         If `archive` is ``False`` none of the archive-handling is done
    87         and respective applicants are simply removed from the
    88         database.
    89         """
    90         raise NotImplementedError()
    9158
    9259    def addApplicant(self, applicant):
     
    10471    @property
    10572    def statistics(self):
    106         return getUtility(IApplicantsUtils).getApplicantsStatistics(self)
     73        try:
     74          statistics = getUtility(
     75              IApplicantsUtils).getApplicantsStatistics(self)
     76        except ComponentLookupError:  # happens in unit tests
     77            return
     78        return statistics
    10779
    10880    @property
     
    12597
    12698    def traverse(self, name):
    127         """Deliver appropriate containers.
     99        """Deliver virtual export container.
    128100        """
    129101        if name == 'exports':
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/interfaces.py

    r13076 r13077  
    149149    """A collection of methods which are subject to customization.
    150150    """
    151 
    152151    APP_TYPES_DICT = Attribute('dict of application types')
    153152
     
    169168
    170169class IApplicantsRoot(IKofaObject, IContainer):
    171     """A container for university applicants containers.
    172     """
     170    """A container for applicants containers.
     171    """
     172    description_dict = Attribute('Language translation dictionary with values in HTML format')
     173    local_roles = Attribute('List of local role names')
     174    logger_name = Attribute('Name of the logger')
     175    logger_filename = Attribute('Name of the logger file')
    173176
    174177    description = schema.Text(
     
    182185        )
    183186
    184     description_dict = Attribute(
    185         """Content as language dictionary with values in HTML format.""")
    186 
    187187class IApplicantsContainer(IKofaObject):
    188     """An applicants container contains university applicants.
    189 
    190     """
     188    """An applicants container contains applicants.
     189    """
     190    statistics = Attribute('Applicant counts')
     191    expired = Attribute('True if application has started but not ended')
     192
     193    description_dict = Attribute('Language translation dictionary with values in HTML format')
     194    local_roles = Attribute('List of local role names')
     195
    191196
    192197    code = schema.TextLine(
     
    246251        )
    247252
    248     description_dict = Attribute(
    249         """Content as language dictionary with values in HTML format.""")
    250 
    251253    startdate = schema.Datetime(
    252254        title = _(u'Application Start Date'),
     
    285287        )
    286288
    287     def archive(id=None):
    288         """Create on-dist archive of applicants stored in this term.
    289 
    290         If id is `None`, all applicants are archived.
    291 
    292         If id contains a single id string, only the respective
    293         applicants are archived.
    294 
    295         If id contains a list of id strings all of the respective
    296         applicants types are saved to disk.
    297         """
    298 
    299     def clear(id=None, archive=True):
    300         """Remove applicants of type given by 'id'.
    301 
    302         Optionally archive the applicants.
    303 
    304         If id is `None`, all applicants are archived.
    305 
    306         If id contains a single id string, only the respective
    307         applicants are archived.
    308 
    309         If id contains a list of id strings all of the respective
    310         applicant types are saved to disk.
    311 
    312         If `archive` is ``False`` none of the archive-handling is done
    313         and respective applicants are simply removed from the
    314         database.
     289    def addApplicant(applicant):
     290        """Add an applicant.
    315291        """
    316292
    317293    def writeLogMessage(view, comment):
    318         """Adds an INFO message to the log file
     294        """Add an INFO message to the log file.
     295        """
     296
     297    def traverse(name):
     298        """Deliver appropriate containers.
    319299        """
    320300
     
    342322
    343323class IApplicantBaseData(IApplicantBase):
    344     """The data for an applicant.
    345 
    346     This is a base interface with no field
     324    """This is a base interface of an applicant with no field
    347325    required. For use with processors, forms, etc., please use one of
    348326    the derived interfaces below, which set more fields to required
    349327    state, depending on use-case.
    350328    """
    351 
    352329    history = Attribute('Object history, a list of messages')
    353330    state = Attribute('The application state of an applicant')
     
    368345        readonly = False,
    369346        )
     347
    370348    reg_number = TextLineChoice(
    371349        title = _(u'Registration Number'),
     
    374352        source = contextual_reg_num_source,
    375353        )
    376     #access_code = schema.TextLine(
    377     #    title = u'Activation Code',
    378     #    required = False,
    379     #    readonly = True,
    380     #    )
     354
    381355    firstname = schema.TextLine(
    382356        title = _(u'First Name'),
    383357        required = True,
    384358        )
     359
    385360    middlename = schema.TextLine(
    386361        title = _(u'Middle Name'),
    387362        required = False,
    388363        )
     364
    389365    lastname = schema.TextLine(
    390366        title = _(u'Last Name (Surname)'),
    391367        required = True,
    392368        )
     369
    393370    date_of_birth = FormattedDate(
    394371        title = _(u'Date of Birth'),
    395372        required = False,
    396         #date_format = u'%d/%m/%Y', # Use grok-instance-wide default
    397373        show_year = True,
    398374        )
     375
    399376    sex = schema.Choice(
    400377        title = _(u'Sex'),
     
    402379        required = True,
    403380        )
     381
    404382    email = schema.ASCIILine(
    405383        title = _(u'Email Address'),
     
    407385        constraint=validate_email,
    408386        )
     387
    409388    phone = PhoneNumber(
    410389        title = _(u'Phone'),
     
    412391        required = False,
    413392        )
     393
    414394    course1 = schema.Choice(
    415395        title = _(u'1st Choice Course of Study'),
     
    417397        required = True,
    418398        )
     399
    419400    course2 = schema.Choice(
    420401        title = _(u'2nd Choice Course of Study'),
     
    422403        required = False,
    423404        )
     405
    424406    #school_grades = schema.List(
    425407    #    title = _(u'School Grades'),
     
    456438
    457439class IApplicant(IApplicantBaseData):
    458     """An applicant.
    459 
    460     This is basically the applicant base data. Here we repeat the
     440    """This is basically the applicant base data. Here we repeat the
    461441    fields from base data if we have to set the `required` attribute
    462442    to True (which is the default).
     
    473453
    474454class ISpecialApplicant(IApplicantBase):
    475     """A special applicant.
    476 
    477     This reduced interface is for former students or students who are not
     455    """This reduced interface is for former students or students who are not
    478456    student users of the portal but have to pay supplementary fees.
    479457
     
    482460    only 'customize' fields.
    483461    """
    484 
    485462    history = Attribute('Object history, a list of messages')
    486463    state = Attribute('The application state of an applicant')
     
    557534
    558535class IApplicantEdit(IApplicant):
    559     """An applicant interface for editing.
     536    """This is an applicant interface for editing.
    560537
    561538    Here we can repeat the fields from base data and set the
     
    573550        constraint=validate_email,
    574551        )
     552
    575553    course1 = schema.Choice(
    576554        title = _(u'1st Choice Course of Study'),
     
    578556        required = True,
    579557        )
     558
    580559    course2 = schema.Choice(
    581560        title = _(u'2nd Choice Course of Study'),
     
    583562        required = False,
    584563        )
     564
    585565    course_admitted = schema.Choice(
    586566        title = _(u'Admitted Course of Study'),
     
    589569        readonly = True,
    590570        )
     571
    591572    notice = schema.Text(
    592573        title = _(u'Notice'),
     
    599580
    600581class IApplicantUpdateByRegNo(IApplicant):
    601     """Representation of an applicant.
    602 
    603     Skip regular reg_number validation if reg_number is used for finding
     582    """Skip regular reg_number validation if reg_number is used for finding
    604583    the applicant object.
    605584    """
     
    610589
    611590class IApplicantRegisterUpdate(IApplicant):
    612     """Representation of an applicant for first-time registration.
    613 
     591    """This is a representation of an applicant for first-time registration.
    614592    This interface is used when applicants use the registration page to
    615593    update their records.
     
    643621    def doAfterApplicantPayment():
    644622        """Process applicant after payment was made.
    645 
    646623        """
    647624
    648625    def doAfterApplicantPaymentApproval():
    649626        """Process applicant after payment was approved.
    650 
    651627        """
    652628
    653629    def approveApplicantPayment():
    654630        """Approve payment and process applicant.
    655 
    656         """
     631        """
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/root.py

    r8773 r13077  
    3636
    3737    local_roles = []
    38 
    39     #: A dictionary to hold per language translations of description string.
    4038    description_dict = {}
    41 
    4239    logger_name = 'waeup.kofa.${sitename}.applicants'
    4340    logger_filename = 'applicants.log'
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_container.py

    r7811 r13077  
    4040        return
    4141
    42     def test_base(self):
    43         # We cannot call the fundamental methods of a base in that case
    44         container = ApplicantsContainer()
    45         self.assertRaises(
    46             NotImplementedError, container.archive)
    47         self.assertRaises(
    48             NotImplementedError, container.clear)
    49 
    5042def suite():
    5143    suite = unittest.TestSuite()
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/helpers.py

    r12974 r13077  
    811811    """Transforms a localized HTML text string into a dictionary.
    812812
    813     Different languages must be separated by `>>xy<<` whereas
     813    Different languages must be separated by ``>>xy<<`` whereas
    814814    xy is the language code. Text parts without correct leading
    815815    language separator - usually the first part has no language
    816816    descriptor - are interpreted as texts in the portal's language.
    817     The latter can be configured in waeup.srp.utils.utils.IkobaUtils.
    818817    """
    819818    try:
     
    838837    """Transforms a localized REST text string into a dictionary.
    839838
    840     Different languages must be separated by `>>xy<<` whereas
     839    Different languages must be separated by ``>>xy<<``` whereas
    841840    xy is the language code. Text parts without correct leading
    842841    language separator - usually the first part has no language
    843842    descriptor - are interpreted as texts in the portal's language.
    844     The latter can be configured in waeup.srp.utils.utils.IkobaUtils.
    845843    """
    846844    try:
Note: See TracChangeset for help on using the changeset viewer.