Ignore:
Timestamp:
7 Jul 2012, 09:25:03 (12 years ago)
Author:
Henrik Bettermann
Message:

Start using components and interfaces in kofacustom.nigeria. Unfortunately, this does not reduce the code in waeup.uniben very much, only because we are still using an old LGAs dictionary.

Move applicants tests into 'tests' package.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/applicants
Files:
4 added
1 deleted
5 edited

Legend:

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

    r8668 r8928  
    2222from waeup.kofa.utils.helpers import attrs_to_fields
    2323from waeup.uniben.applicants.interfaces import(
    24     ICustomApplicant, IUGApplicantEdit, IPGApplicantEdit, IPUTMEApplicantEdit)
     24    ICustomApplicant, ICustomUGApplicantEdit, ICustomPGApplicantEdit, IPUTMEApplicantEdit)
    2525
    2626class CustomApplicant(Applicant):
    2727
    28     grok.implements(ICustomApplicant, IUGApplicantEdit,
    29         IPGApplicantEdit, IPUTMEApplicantEdit)
     28    grok.implements(ICustomApplicant, ICustomUGApplicantEdit,
     29        ICustomPGApplicantEdit, IPUTMEApplicantEdit)
    3030    grok.provides(ICustomApplicant)
    3131
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser.py

    r8839 r8928  
    3636from waeup.kofa.applicants.pdf import PDFApplicationSlip
    3737from waeup.uniben.applicants.interfaces import (
    38     IPGApplicant, IUGApplicant, IPGApplicantEdit, IUGApplicantEdit,
     38    ICustomPGApplicant, ICustomUGApplicant, ICustomPGApplicantEdit, ICustomUGApplicantEdit,
    3939    ICustomApplicantOnlinePayment, IPUTMEApplicantEdit,
    4040    UG_OMIT_DISPLAY_FIELDS, PG_OMIT_DISPLAY_FIELDS,
     
    8181        target = getattr(self.context.__parent__, 'prefix', None)
    8282        if target is not None and target.startswith('pg'):
    83             form_fields = grok.AutoFields(IPGApplicant)
     83            form_fields = grok.AutoFields(ICustomPGApplicant)
    8484            for field in PG_OMIT_PDF_FIELDS:
    8585                form_fields = form_fields.omit(field)
    8686        else:
    87             form_fields = grok.AutoFields(IUGApplicant)
     87            form_fields = grok.AutoFields(ICustomUGApplicant)
    8888            if self._reduced_slip():
    8989                for field in UG_OMIT_RESULT_SLIP_FIELDS:
     
    104104        target = getattr(self.context.__parent__, 'prefix', None)
    105105        if target is not None and target.startswith('pg'):
    106             form_fields = grok.AutoFields(IPGApplicant)
     106            form_fields = grok.AutoFields(ICustomPGApplicant)
    107107            for field in PG_OMIT_DISPLAY_FIELDS:
    108108                form_fields = form_fields.omit(field)
    109109        else:
    110             form_fields = grok.AutoFields(IUGApplicant)
     110            form_fields = grok.AutoFields(ICustomUGApplicant)
    111111            for field in UG_OMIT_DISPLAY_FIELDS:
    112112                form_fields = form_fields.omit(field)
     
    121121        target = getattr(self.context.__parent__, 'prefix', None)
    122122        if target is not None and target.startswith('pg'):
    123             form_fields = grok.AutoFields(IPGApplicant)
     123            form_fields = grok.AutoFields(ICustomPGApplicant)
    124124            for field in PG_OMIT_MANAGE_FIELDS:
    125125                form_fields = form_fields.omit(field)
    126126        else:
    127             form_fields = grok.AutoFields(IUGApplicant)
     127            form_fields = grok.AutoFields(ICustomUGApplicant)
    128128            for field in UG_OMIT_MANAGE_FIELDS:
    129129                form_fields = form_fields.omit(field)
     
    140140        target = getattr(self.context.__parent__, 'prefix', None)
    141141        if target is not None and target.startswith('pg'):
    142             form_fields = grok.AutoFields(IPGApplicantEdit)
     142            form_fields = grok.AutoFields(ICustomPGApplicantEdit)
    143143            for field in PG_OMIT_EDIT_FIELDS:
    144144                form_fields = form_fields.omit(field)
     
    148148                form_fields = form_fields.omit(field)
    149149        else:
    150             form_fields = grok.AutoFields(IUGApplicantEdit)
     150            form_fields = grok.AutoFields(ICustomUGApplicantEdit)
    151151            for field in UG_OMIT_EDIT_FIELDS:
    152152                form_fields = form_fields.omit(field)
     
    164164    form_fields[
    165165        'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    166 
    167 class CustomApplicationFeePaymentAddPage(ApplicationFeePaymentAddPage):
    168     """ Page to add an online payment ticket
    169     """
    170     factory = u'waeup.CustomApplicantOnlinePayment'
    171166
    172167class CustomExportPDFPaymentSlipPage(ExportPDFPaymentSlipPage):
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/export.py

    r8441 r8928  
    2121from waeup.kofa.applicants.interfaces import IApplicantBaseData
    2222from waeup.kofa.applicants.export import ApplicantsExporter
    23 from waeup.uniben.applicants.interfaces import IUGApplicant, IPGApplicant
     23from waeup.uniben.applicants.interfaces import ICustomUGApplicant, ICustomPGApplicant
    2424
    2525class CustomApplicantsExporter(ApplicantsExporter):
     
    2828
    2929    fields = tuple(sorted(set(
    30         IUGApplicant.names() +
    31         IPGApplicant.names() +
     30        ICustomUGApplicant.names() +
     31        ICustomPGApplicant.names() +
    3232        IApplicantBaseData.names()
    3333        ))) + ('container_code',)
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/interfaces.py

    r8844 r8928  
    2929from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
    3030from waeup.kofa.applicants.interfaces import contextual_reg_num_source
    31 from kofacustom.nigeria.interfaces import (
    32     LGASource, high_qual, high_grade, exam_types)
     31from kofacustom.nigeria.applicants.interfaces import (
     32    LGASource, high_qual, high_grade, exam_types,
     33    INigeriaUGApplicant, INigeriaPGApplicant,
     34    INigeriaApplicantOnlinePayment,
     35    UG_OMIT_DISPLAY_FIELDS,
     36    UG_OMIT_PDF_FIELDS,
     37    UG_OMIT_MANAGE_FIELDS,
     38    UG_OMIT_EDIT_FIELDS,
     39    PUTME_OMIT_EDIT_FIELDS,
     40    UG_OMIT_RESULT_SLIP_FIELDS,
     41    PG_OMIT_DISPLAY_FIELDS,
     42    PG_OMIT_PDF_FIELDS,
     43    PG_OMIT_MANAGE_FIELDS,
     44    PG_OMIT_EDIT_FIELDS,
     45    )
    3346from waeup.uniben.interfaces import MessageFactory as _
    3447from waeup.uniben.payments.interfaces import ICustomOnlinePayment
     
    4356############################################################
    4457
    45 UG_OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted',
    46     'password', 'result_uploaded')
    47 UG_OMIT_PDF_FIELDS = UG_OMIT_DISPLAY_FIELDS + ('email', 'phone')
    48 UG_OMIT_MANAGE_FIELDS = ()
    49 UG_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + ('locked', 'course_admitted',
    50     'student_id', 'screening_score', 'screening_venue', 'notice',
    51     'screening_date', 'result_uploaded')
    52 PUTME_OMIT_EDIT_FIELDS = UG_OMIT_EDIT_FIELDS + (
    53     'firstname', 'middlename', 'lastname', 'sex',
    54     'course1', 'lga', 'jamb_score', 'jamb_subjects')
    55 UG_OMIT_RESULT_SLIP_FIELDS = UG_OMIT_DISPLAY_FIELDS + ('email', 'phone',
    56     'date_of_birth', 'sex',
    57     'nationality', 'lga', 'perm_address', 'course2', 'screening_venue',
    58     'screening_date')
    59 
    60 PG_OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted', 'password')
    61 PG_OMIT_PDF_FIELDS = UG_OMIT_DISPLAY_FIELDS + ('email', 'phone')
    62 PG_OMIT_MANAGE_FIELDS = ()
    63 PG_OMIT_EDIT_FIELDS = PG_OMIT_MANAGE_FIELDS + (
    64     'locked', 'course_admitted',
    65     'student_id', 'screening_score', 'screening_venue', 'notice',
    66     'screening_date')
    67 
    68 class IUGApplicant(IApplicantBaseData):
     58class ICustomUGApplicant(INigeriaUGApplicant):
    6959    """An undergraduate applicant.
    7060
     
    146136        )
    147137
    148 class IPGApplicant(IApplicantBaseData):
     138class ICustomPGApplicant(INigeriaPGApplicant):
    149139    """A postgraduate applicant.
    150140
     
    325315        )
    326316
    327 class ICustomApplicant(IUGApplicant, IPGApplicant):
     317class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
    328318    """An interface for both types of applicants.
    329319
    330     Attention: The IPGApplicant field seetings will be overwritten
    331     by IPGApplicant field settings. If a field is defined
     320    Attention: The ICustomPGApplicant field seetings will be overwritten
     321    by ICustomPGApplicant field settings. If a field is defined
    332322    in both interfaces zope.schema validates only against the
    333     constraints in IUGApplicant. This does not affect the forms
    334     since they are build on either IUGApplicant or IPGApplicant.
     323    constraints in ICustomUGApplicant. This does not affect the forms
     324    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
    335325    """
    336326
     
    344334        """
    345335
    346 class IUGApplicantEdit(IUGApplicant):
     336class ICustomUGApplicantEdit(ICustomUGApplicant):
    347337    """An undergraduate applicant interface for edit forms.
    348338
     
    367357        )
    368358
    369 IUGApplicantEdit[
    370     'date_of_birth'].order =  IUGApplicant['date_of_birth'].order
    371 IUGApplicantEdit[
    372     'email'].order =  IUGApplicant['email'].order
    373 
    374 class IPGApplicantEdit(IPGApplicant):
     359ICustomUGApplicantEdit[
     360    'date_of_birth'].order =  ICustomUGApplicant['date_of_birth'].order
     361ICustomUGApplicantEdit[
     362    'email'].order =  ICustomUGApplicant['email'].order
     363
     364class ICustomPGApplicantEdit(ICustomPGApplicant):
    375365    """A postgraduate applicant interface for editing.
    376366
     
    395385        )
    396386
    397 IPGApplicantEdit[
    398     'date_of_birth'].order =  IPGApplicant['date_of_birth'].order
    399 IPGApplicantEdit[
    400     'email'].order =  IPGApplicant['email'].order
    401 
    402 class ICustomApplicantOnlinePayment(ICustomOnlinePayment):
     387ICustomPGApplicantEdit[
     388    'date_of_birth'].order =  ICustomPGApplicant['date_of_birth'].order
     389ICustomPGApplicantEdit[
     390    'email'].order =  ICustomPGApplicant['email'].order
     391
     392class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
    403393    """An applicant payment via payment gateways.
    404394
    405395    """
    406396
    407 class IPUTMEApplicantEdit(IUGApplicant):
     397class IPUTMEApplicantEdit(ICustomUGApplicant):
    408398    """An undergraduate applicant interface for editing.
    409399
     
    428418
    429419IPUTMEApplicantEdit[
    430     'date_of_birth'].order =  IUGApplicant['date_of_birth'].order
     420    'date_of_birth'].order =  ICustomUGApplicant['date_of_birth'].order
    431421IPUTMEApplicantEdit[
    432     'email'].order =  IUGApplicant['email'].order
     422    'email'].order =  ICustomUGApplicant['email'].order
    433423
    434424class ICustomApplicantUpdateByRegNo(ICustomApplicant):
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/payment.py

    r8421 r8928  
    4848    """
    4949    grok.implements(IFactory)
    50     grok.name(u'waeup.CustomApplicantOnlinePayment')
     50    grok.name(u'waeup.ApplicantOnlinePayment')
    5151    title = u"Create a new online payment.",
    5252    description = u"This factory instantiates new online payment instances."
Note: See TracChangeset for help on using the changeset viewer.