- Timestamp:
- 16 Dec 2015, 06:07:20 (9 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue/applicants
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/applicants/applicant.py
r11617 r13544 23 23 from kofacustom.nigeria.applicants.applicant import NigeriaApplicant 24 24 from waeup.aaue.applicants.interfaces import( 25 ICustomApplicant, ICustomUGApplicantEdit, ICustomPGApplicantEdit, IPUTMEApplicantEdit) 25 ICustomApplicant, ICustomUGApplicantEdit, ICustomPGApplicantEdit, 26 IPUTMEApplicantEdit, ITranscriptApplicant) 26 27 27 28 class CustomApplicant(NigeriaApplicant): 28 29 29 30 grok.implements(ICustomApplicant, ICustomUGApplicantEdit, 30 ICustomPGApplicantEdit, IPUTMEApplicantEdit )31 ICustomPGApplicantEdit, IPUTMEApplicantEdit, ITranscriptApplicant) 31 32 grok.provides(ICustomApplicant) 32 33 -
main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser.py
r13541 r13544 26 26 from waeup.kofa.utils.helpers import string_from_bytes, file_size 27 27 from waeup.kofa.applicants.browser import ApplicantCheckStatusPage 28 from waeup.kofa.applicants.interfaces import ISpecialApplicant29 28 from waeup.kofa.applicants.viewlets import PDFActionButton 30 29 from waeup.aaue.interfaces import MessageFactory as _ … … 41 40 UG_OMIT_EDIT_FIELDS) 42 41 from waeup.aaue.applicants.interfaces import ( 43 ICustomApplicant,44 42 ICustomUGApplicant, 45 ICustomUGApplicantEdit 43 ICustomUGApplicantEdit, 44 ITranscriptApplicant 46 45 ) 47 46 … … 71 70 def form_fields(self): 72 71 if self.target is not None and self.target == 'trans': 73 return grok.AutoFields(ISpecialApplicant).omit( 74 'locked', 'suspended', 'special_application') 72 form_fields = grok.AutoFields(ITranscriptApplicant).omit( 73 'locked', 'suspended') 74 form_fields['dispatch_address'].custom_widget = BytesDisplayWidget 75 form_fields['perm_address'].custom_widget = BytesDisplayWidget 76 return form_fields 75 77 # AAUE is using the same interface for all regular applications. 76 78 form_fields = grok.AutoFields(ICustomUGApplicant) … … 160 162 def form_fields(self): 161 163 if self.target is not None and self.target == 'trans': 162 form_fields = grok.AutoFields(ISpecialApplicant).omit( 163 'special_application') 164 form_fields = grok.AutoFields(ITranscriptApplicant) 164 165 form_fields['applicant_id'].for_display = True 165 166 return form_fields … … 188 189 def form_fields(self): 189 190 if self.target is not None and self.target == 'trans': 190 form_fields = grok.AutoFields(I SpecialApplicant).omit(191 'locked', 'suspended' , 'special_application')191 form_fields = grok.AutoFields(ITranscriptApplicant).omit( 192 'locked', 'suspended') 192 193 form_fields['applicant_id'].for_display = True 193 194 return form_fields -
main/waeup.aaue/trunk/src/waeup/aaue/applicants/export.py
r13093 r13544 23 23 from kofacustom.nigeria.applicants.interfaces import ( 24 24 INigeriaUGApplicant, INigeriaPGApplicant) 25 from waeup.aaue.applicants.interfaces import ICustomUGApplicant 25 from waeup.aaue.applicants.interfaces import ( 26 ICustomUGApplicant, ITranscriptApplicant) 26 27 27 28 class CustomApplicantExporter(NigeriaApplicantExporter): … … 33 34 #INigeriaUGApplicant.names() + 34 35 INigeriaPGApplicant.names() + 35 IApplicantBaseData.names() 36 IApplicantBaseData.names() + 37 ITranscriptApplicant.names() 36 38 ))) -
main/waeup.aaue/trunk/src/waeup/aaue/applicants/interfaces.py
r11542 r13544 27 27 from waeup.kofa.interfaces import ( 28 28 SimpleKofaVocabulary, academic_sessions_vocab, validate_email) 29 from waeup.kofa.schema import FormattedDate, TextLineChoice 30 from waeup.kofa.students.vocabularies import nats_vocab, GenderSource 29 from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber 30 from waeup.kofa.interfaces import IKofaObject 31 from waeup.kofa.students.vocabularies import ( 32 nats_vocab, GenderSource, StudyLevelSource) 31 33 from waeup.kofa.applicants.interfaces import ( 32 34 contextual_reg_num_source, 33 35 IApplicantBaseData) 36 from waeup.kofa.university.vocabularies import StudyModeSource 34 37 from kofacustom.nigeria.applicants.interfaces import ( 35 38 LGASource, high_qual, high_grade, exam_types, … … 279 282 """ 280 283 281 class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant): 282 """An interface for both types of applicants. 284 class ITranscriptApplicant(IKofaObject): 285 """A transcript applicant. 286 """ 287 288 suspended = schema.Bool( 289 title = _(u'Account suspended'), 290 default = False, 291 required = False, 292 ) 293 294 locked = schema.Bool( 295 title = _(u'Form locked'), 296 default = False, 297 required = False, 298 ) 299 300 applicant_id = schema.TextLine( 301 title = _(u'Applicant Id'), 302 required = False, 303 readonly = False, 304 ) 305 306 firstname = schema.TextLine( 307 title = _(u'First Name'), 308 required = True, 309 ) 310 311 middlename = schema.TextLine( 312 title = _(u'Middle Name'), 313 required = False, 314 ) 315 316 lastname = schema.TextLine( 317 title = _(u'Last Name (Surname)'), 318 required = True, 319 ) 320 321 matric_number = schema.TextLine( 322 title = _(u'Matriculation Number'), 323 readonly = False, 324 required = True, 325 ) 326 327 date_of_birth = FormattedDate( 328 title = _(u'Date of Birth'), 329 required = False, 330 #date_format = u'%d/%m/%Y', # Use grok-instance-wide default 331 show_year = True, 332 ) 333 334 place_of_birth = schema.TextLine( 335 title = _(u'Place of Birth'), 336 readonly = False, 337 required = False, 338 ) 339 340 nationality = schema.Choice( 341 vocabulary = nats_vocab, 342 title = _(u'Nationality'), 343 required = False, 344 ) 345 346 email = schema.ASCIILine( 347 title = _(u'Email Address'), 348 required = True, 349 constraint=validate_email, 350 ) 351 352 phone = PhoneNumber( 353 title = _(u'Phone'), 354 description = u'', 355 required = False, 356 ) 357 358 perm_address = schema.Text( 359 title = _(u'Current Local Address'), 360 required = False, 361 readonly = False, 362 ) 363 364 dispatch_address = schema.Text( 365 title = _(u'Dispatch Address'), 366 description = u'Address to which transcript should be posted.', 367 required = False, 368 readonly = False, 369 ) 370 371 entry_mode = schema.Choice( 372 title = _(u'Entry Mode'), 373 source = StudyModeSource(), 374 required = False, 375 readonly = False, 376 ) 377 378 entry_session = schema.Choice( 379 title = _(u'Entry Session'), 380 source = academic_sessions_vocab, 381 required = False, 382 readonly = False, 383 ) 384 385 end_session = schema.Choice( 386 title = _(u'End Session'), 387 source = academic_sessions_vocab, 388 required = False, 389 readonly = False, 390 ) 391 392 course_studied = schema.Choice( 393 title = _(u'Course of Study / Degree'), 394 source = CertificateSource(), 395 required = False, 396 readonly = False, 397 ) 398 399 purpose = schema.TextLine( 400 title = _(u'Purpose of this Application'), 401 readonly = False, 402 required = False, 403 ) 404 405 course_changed = schema.Choice( 406 title = _(u'Change of Study Course'), 407 description = u'If yes, select previous course of study.', 408 source = CertificateSource(), 409 readonly = False, 410 required = False, 411 ) 412 413 change_level = schema.Choice( 414 title = _(u'Change Level'), 415 description = u'If yes, select level at which you changed course of study.', 416 source = StudyLevelSource(), 417 required = False, 418 readonly = False, 419 ) 420 421 422 class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant, 423 ITranscriptApplicant): 424 """An interface for all three types of applicants. 283 425 284 426 Attention: The ICustomPGApplicant field seetings will be overwritten … … 355 497 """ 356 498 499 500 -
main/waeup.aaue/trunk/src/waeup/aaue/applicants/tests/test_browser.py
r11755 r13544 17 17 ## 18 18 import grok 19 import datetime 20 import pytz 19 21 from zope.event import notify 20 22 from zope.component import createObject, getUtility 21 23 from waeup.kofa.configuration import SessionConfiguration 24 from waeup.kofa.applicants.container import ApplicantsContainer 22 25 from waeup.aaue.testing import FunctionalLayer 23 26 from waeup.kofa.applicants.tests.test_browser import ( … … 65 68 'application/pdf') 66 69 return 70 71 def test_transcript_application_manage(self): 72 # Add trans applicants container 73 self.transcontainer = ApplicantsContainer() 74 self.transcontainer.mode = 'create' 75 self.transcontainer.code = u'trans%s' % session_1 76 self.transcontainer.prefix = u'trans' 77 self.transcontainer.application_category = u'no' 78 self.transcontainer.year = session_1 79 self.transcontainer.application_fee = 300.0 80 self.transcontainer.title = u'This is the trans%s container' % session_1 81 self.app['applicants'][self.transcontainer.code] = self.transcontainer 82 delta = datetime.timedelta(days=10) 83 self.transcontainer.startdate = datetime.datetime.now(pytz.utc) - delta 84 self.transcontainer.enddate = datetime.datetime.now(pytz.utc) + delta 85 # Add applicant 86 transapplicant = createObject(u'waeup.Applicant') 87 transapplicant.firstname = u'Anna' 88 transapplicant.lastname = u'Post' 89 self.app['applicants'][self.transcontainer.code].addApplicant(transapplicant) 90 self.transapplication_number = transapplicant.application_number 91 self.transapplicant = self.app['applicants'][self.transcontainer.code][ 92 self.transapplication_number] 93 self.transapplicant_path = ('http://localhost/app/applicants/trans%s/%s' 94 % (session_1, self.transapplication_number)) 95 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 96 self.browser.open(self.transapplicant_path) 97 self.assertEqual(self.browser.headers['Status'], '200 Ok') 98 self.assertTrue("Dispatch Address" in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.