Changeset 8519 for main/waeup.uniben


Ignore:
Timestamp:
25 May 2012, 10:30:40 (12 years ago)
Author:
Henrik Bettermann
Message:

Define fields to be omitted in interfaces.py.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/applicants
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser.py

    r8506 r8519  
    3737from waeup.uniben.applicants.interfaces import (
    3838    IPGApplicant, IUGApplicant, IPGApplicantEdit, IUGApplicantEdit,
    39     ICustomApplicantOnlinePayment)
     39    ICustomApplicantOnlinePayment,
     40    UG_OMIT_DISPLAY_FIELDS, PG_OMIT_DISPLAY_FIELDS,
     41    UG_OMIT_MANAGE_FIELDS, PG_OMIT_MANAGE_FIELDS,
     42    UG_OMIT_EDIT_FIELDS, PG_OMIT_EDIT_FIELDS)
    4043from waeup.uniben.interfaces import MessageFactory as _
    4144
     
    6568        target = getattr(self.context.__parent__, 'prefix', None)
    6669        if target is not None and target.startswith('pg'):
    67             form_fields = grok.AutoFields(IPGApplicant).omit(
    68                 'locked', 'course_admitted')
     70            form_fields = grok.AutoFields(IPGApplicant)
     71            for field in PG_OMIT_DISPLAY_FIELDS:
     72                form_fields = form_fields.omit(field)
    6973        else:
    70             form_fields = grok.AutoFields(IUGApplicant).omit(
    71                 'locked', 'course_admitted')
     74            form_fields = grok.AutoFields(IUGApplicant)
     75            for field in UG_OMIT_DISPLAY_FIELDS:
     76                form_fields = form_fields.omit(field)
    7277        return form_fields
    7378
     
    8085        target = getattr(self.context.__parent__, 'prefix', None)
    8186        if target is not None and target.startswith('pg'):
    82             form_fields = grok.AutoFields(IPGApplicant).omit(
    83                 'locked', 'course_admitted', 'password')
     87            form_fields = grok.AutoFields(IPGApplicant)
     88            for field in PG_OMIT_DISPLAY_FIELDS:
     89                form_fields = form_fields.omit(field)
    8490        else:
    85             form_fields = grok.AutoFields(IUGApplicant).omit(
    86                 'locked', 'course_admitted', 'password')
     91            form_fields = grok.AutoFields(IUGApplicant)
     92            for field in UG_OMIT_DISPLAY_FIELDS:
     93                form_fields = form_fields.omit(field)
    8794        return form_fields
    8895
     
    96103        if target is not None and target.startswith('pg'):
    97104            form_fields = grok.AutoFields(IPGApplicant)
     105            for field in PG_OMIT_MANAGE_FIELDS:
     106                form_fields = form_fields.omit(field)
    98107        else:
    99108            form_fields = grok.AutoFields(IUGApplicant)
     109            for field in UG_OMIT_MANAGE_FIELDS:
     110                form_fields = form_fields.omit(field)
    100111        form_fields['student_id'].for_display = True
    101112        form_fields['applicant_id'].for_display = True
     
    110121        target = getattr(self.context.__parent__, 'prefix', None)
    111122        if target is not None and target.startswith('pg'):
    112             form_fields = grok.AutoFields(IPGApplicantEdit).omit(
    113                 'locked', 'course_admitted', 'student_id',
    114                 'screening_score', 'screening_venue'
    115                 )
     123            form_fields = grok.AutoFields(IPGApplicantEdit)
     124            for field in PG_OMIT_EDIT_FIELDS:
     125                form_fields = form_fields.omit(field)
    116126        else:
    117             form_fields = grok.AutoFields(IUGApplicantEdit).omit(
    118                 'locked', 'course_admitted', 'student_id',
    119                 'screening_score'
    120                 )
     127            form_fields = grok.AutoFields(IUGApplicantEdit)
     128            for field in UG_OMIT_EDIT_FIELDS:
     129                form_fields = form_fields.omit(field)
    121130        form_fields['applicant_id'].for_display = True
    122131        form_fields['reg_number'].for_display = True
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/interfaces.py

    r8502 r8519  
    3232from waeup.uniben.payments.interfaces import ICustomOnlinePayment
    3333
     34UG_OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted', 'password')
     35UG_OMIT_MANAGE_FIELDS = ()
     36UG_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + ('locked', 'course_admitted',
     37    'student_id', 'screening_score', 'screening_venue')
     38
     39PG_OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted', 'password')
     40PG_OMIT_MANAGE_FIELDS = ()
     41PG_OMIT_EDIT_FIELDS = PG_OMIT_MANAGE_FIELDS + ('locked', 'course_admitted',
     42    'student_id', 'screening_score', 'screening_venue')
     43
    3444class IUGApplicant(IApplicantBaseData):
    3545    """An undergraduate applicant.
    3646
     47    This interface defines the least common multiple of all fields
     48    in ug application forms. In customized forms, fields can be excluded by
     49    adding them to the UG_OMIT* tuples.
    3750    """
    3851
     
    5871    """A postgraduate applicant.
    5972
     73    This interface defines the least common multiple of all fields
     74    in pg application forms. In customized forms, fields can be excluded by
     75    adding them to the PG_OMIT* tuples.
    6076    """
    6177
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/tests.py

    r8196 r8519  
    123123        self.browser.open(pgapplicant_path + '/application_slip.pdf')
    124124        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    125         # If we lool at the applicant in the ug container,
     125        # If we view the applicant in the ug container,
    126126        # the employer field doesn't appear
    127127        ugapplicant_path = ('http://localhost/app/applicants/app2011/%s'
Note: See TracChangeset for help on using the changeset viewer.