- Timestamp:
- 20 Sep 2012, 08:49:37 (12 years ago)
- Location:
- main/waeup.kofa/branches/uli-zc-async
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/uli-zc-async
- Property svn:mergeinfo changed
-
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/applicant.py
r9079 r9209 27 27 from zope.securitypolicy.interfaces import IPrincipalRoleManager 28 28 from zope.interface import implementedBy 29 from zope.schema.interfaces import RequiredMissing 29 from zope.schema.interfaces import RequiredMissing, ConstraintNotSatisfied 30 30 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 31 31 from waeup.kofa.image import KofaImageFile … … 36 36 from waeup.kofa.interfaces import MessageFactory as _ 37 37 from waeup.kofa.students.vocabularies import RegNumNotInSource 38 from waeup.kofa.students.studycourse import StudentStudyCourse 38 39 from waeup.kofa.utils.helpers import attrs_to_fields 39 40 from waeup.kofa.applicants.interfaces import IApplicant, IApplicantEdit … … 118 119 if self.course_admitted is None: 119 120 return False, _('No course admitted provided.') 120 # Add student object121 # Set student attributes 121 122 try: 122 123 for name in self.create_names: 123 124 setattr(student, name, getattr(self, name, None)) 124 125 except RequiredMissing, err: 125 return False, _('RequiredMissing: %s' % err) 126 return False, 'RequiredMissing: %s' % err 127 except: 128 return False, 'Error: %s' % err 129 # Finally prove if the certificate still exists 130 try: 131 StudentStudyCourse().certificate = self.course_admitted 132 except ConstraintNotSatisfied, err: 133 return False, 'ConstraintNotSatisfied: %s' % self.course_admitted.code 134 # Add student 126 135 site = grok.getSite() 127 136 site['students'].addStudent(student) 137 # Save student_id 128 138 self.student_id = student.student_id 139 # Fire transitions 129 140 IWorkflowInfo(self).fireTransition('create') 130 141 IWorkflowInfo(student).fireTransition('admit') 131 132 142 # Set password 133 143 IUserAccount(student).setPassword(self.application_number) 134 135 144 # Save the certificate and set session attributes 136 145 student['studycourse'].certificate = self.course_admitted … … 142 151 # Update the catalog 143 152 notify(grok.ObjectModifiedEvent(student)) 144 145 153 # Save application slip 146 154 self._createApplicationPDF(student, view=view) -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/batching.py
r8617 r9209 40 40 grok.provides(IBatchProcessor) 41 41 grok.context(Interface) 42 util_name = 'applicants containerprocessor'42 util_name = 'applicantscontainerprocessor' 43 43 grok.name(util_name) 44 44 -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/browser.py
r9166 r9209 309 309 pnav = 3 310 310 311 form_fields = grok.AutoFields(IApplicantsContainer).omit('title') 312 form_fields['description'].custom_widget = HTMLDisplayWidget 313 form_fields[ 314 'startdate'].custom_widget = FriendlyDatetimeDisplayWidget('le') 315 form_fields[ 316 'enddate'].custom_widget = FriendlyDatetimeDisplayWidget('le') 311 @property 312 def form_fields(self): 313 form_fields = grok.AutoFields(IApplicantsContainer).omit('title') 314 form_fields['description'].custom_widget = HTMLDisplayWidget 315 form_fields[ 316 'startdate'].custom_widget = FriendlyDatetimeDisplayWidget('le') 317 form_fields[ 318 'enddate'].custom_widget = FriendlyDatetimeDisplayWidget('le') 319 if self.request.principal.id == 'zope.anybody': 320 form_fields = form_fields.omit( 321 'code', 'prefix', 'year', 'mode', 322 'strict_deadline', 'application_category') 323 return form_fields 317 324 318 325 @property … … 494 501 grok.template('applicantdisplaypage') 495 502 form_fields = grok.AutoFields(IApplicant).omit( 496 'locked', 'course_admitted', 'password' )503 'locked', 'course_admitted', 'password', 'suspended') 497 504 label = _('Applicant') 498 505 pnav = 3 506 hide_hint = False 499 507 500 508 @property … … 539 547 grok.name('base') 540 548 form_fields = grok.AutoFields(IApplicant).select( 541 'applicant_id', 'firstname', 'lastname','email', 'course1')549 'applicant_id','email', 'course1') 542 550 543 551 class CreateStudentPage(UtilityView, grok.View): … … 708 716 709 717 def update(self): 710 if self.context.state in ('initialized', 'started' ):718 if self.context.state in ('initialized', 'started', 'paid'): 711 719 self.flash( 712 _('Please pay before trying to download the application slip.'))720 _('Please pay and submit before trying to download the application slip.')) 713 721 return self.redirect(self.url(self.context)) 714 722 return … … 882 890 form_fields = grok.AutoFields(IApplicantEdit).omit( 883 891 'locked', 'course_admitted', 'student_id', 884 's creening_score',892 'suspended' 885 893 ) 886 894 form_fields['applicant_id'].for_display = True … … 1034 1042 return 1035 1043 1036 @action(_(' Get login credentials'), style='primary')1044 @action(_('Send login credentials to email address'), style='primary') 1037 1045 def register(self, **data): 1038 1046 if not self.captcha_result.is_valid: … … 1085 1093 # Send email with credentials 1086 1094 login_url = self.url(grok.getSite(), 'login') 1095 url_info = u'Login: %s' % login_url 1087 1096 msg = _('You have successfully been registered for the') 1088 1097 if kofa_utils.sendCredentials(IUserAccount(applicant), 1089 password, login_url, msg):1098 password, url_info, msg): 1090 1099 email_sent = applicant.email 1091 1100 else: -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/browser_templates/applicantdisplaypage.pt
r8273 r9209 1 <h2> 2 ... <span tal:replace="context/translated_state">APPLICATIONSTATE</span> ... 1 <h2 i18n:domain="waeup.kofa"> 2 ... 3 <span tal:replace="context/translated_state">APPLICATIONSTATE 4 </span> 5 <span tal:omit-tag="" 6 i18n:translate="" tal:condition="context/suspended">(account suspended) 7 </span> 8 ... 3 9 </h2> 4 10 … … 14 20 <tbody> 15 21 <tal:widgets content="structure provider:widgets" /> 16 <tr >22 <tr tal:condition="view/getCourseAdmitted"> 17 23 <td class="fieldname" i18n:translate=""> 18 24 Admitted Course of Study: -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/browser_templates/applicanteditpage.pt
r8486 r9209 3 3 autocomplete="off"> 4 4 5 <h2> 6 ... <span tal:replace="context/translated_state">APPLICATIONSTATE</span> ... 5 <h2 i18n:domain="waeup.kofa"> 6 ... 7 <span tal:replace="context/translated_state">APPLICATIONSTATE 8 </span> 9 <span tal:omit-tag="" 10 i18n:translate="" tal:condition="context/suspended">(account suspended) 11 </span> 12 ... 7 13 </h2> 8 14 -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/browser_templates/applicantregemailsent.pt
r8629 r9209 29 29 <tr> 30 30 </table> 31 <p i18n:translate="">32 Print this page and proceed to the31 <p> 32 <span i18n:translate="">Print this page and proceed to the</span> 33 33 <a tal:attributes="href python: view.url(layout.site, 'login')">login form</a>. 34 Please note that passwords are case-sensitive,34 <span i18n:translate="">Please note that passwords are case-sensitive, 35 35 <br />when entering your credentials, and keep your password secret! 36 </span> 36 37 </p> 37 38 <p tal:condition = "view/email"> -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/browser_templates/applicantscontainerpage.pt
r8406 r9209 1 <span tal:condition="view/introduction" tal:omit-tag=""> 2 <p tal:content="structure view/introduction">INTRODUCTION</p> 3 </span> 4 5 <table class="form-table" tal:condition="layout/isAuthenticated"> 1 <table class="form-table"> 6 2 <tbody> 7 3 <tal:block repeat="widget view/widgets"> … … 19 15 </tbody> 20 16 </table> 17 18 <span tal:condition="view/introduction" tal:omit-tag=""> 19 <p tal:content="structure view/introduction">INTRODUCTION</p> 20 </span> -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/browser_templates/applicantsrootpage.pt
r8388 r9209 25 25 </td> 26 26 <td> 27 <span tal:content="python: layout.format Date(entry.startdate)">START</span>27 <span tal:content="python: layout.formatTZDate(entry.startdate)">START</span> 28 28 - 29 <span tal:content="python: layout.format Date(entry.enddate)">END</span>29 <span tal:content="python: layout.formatTZDate(entry.enddate)">END</span> 30 30 </td> 31 31 </tr> -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/container.py
r8665 r9209 51 51 description_dict = {} 52 52 53 @property 54 def local_roles(self): 55 return [] 53 local_roles = [] 56 54 57 55 def archive(self, app_ids=None): -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/dynamicroles.py
r7811 r9209 24 24 import grok 25 25 from zope.securitypolicy.interfaces import IPrincipalRoleManager 26 from zope.securitypolicy.principalrole import AnnotationPrincipalRoleManager 26 27 from waeup.kofa.applicants.interfaces import IApplicant 27 from waeup.kofa.students.dynamicroles import StudentPrincipalRoleManager28 28 29 29 # All components in here have the same context: Applicant instances 30 30 grok.context(IApplicant) 31 31 32 class ApplicantPrincipalRoleManager( StudentPrincipalRoleManager):33 32 class ApplicantPrincipalRoleManager(AnnotationPrincipalRoleManager, 33 grok.Adapter): 34 34 grok.provides(IPrincipalRoleManager) 35 35 36 36 #: The attribute name to lookup for additional roles 37 37 extra_attrib = 'course1' 38 subcontainer = None39 38 40 39 # Role name mapping: … … 45 44 'waeup.local.ClearanceOfficer':'waeup.ApplicationsOfficer', 46 45 } 46 47 def getRolesForPrincipal(self, principal_id): 48 """Get roles for principal with id `principal_id`. 49 50 Different to the default implementation, this method also 51 takes into account local roles set on any department connected 52 to the context student. 53 54 If the given principal has at least one of the 55 `external_rolenames` roles granted for the external object, it 56 additionally gets `additional_rolename` role for the context 57 student. 58 59 For the additional roles the `extra_attrib` and all its parent 60 objects are looked up, because 'role inheritance' does not 61 work on that basic level of permission handling. 62 63 Some advantages of this approach: 64 65 - we don't have to store extra local roles for clearance 66 officers in ZODB for each student 67 68 - when local roles on a department change, we don't have to 69 update thousands of students; the local role is assigned 70 dynamically. 71 72 Disadvantage: 73 74 - More expensive role lookups when a clearance officer wants 75 to see an student form. 76 77 This implementation is designed to be usable also for other 78 contexts than students. You can inherit from it and set 79 different role names to lookup/set easily via the static class 80 attributes. 81 """ 82 apr_manager = AnnotationPrincipalRoleManager(self._context) 83 result = apr_manager.getRolesForPrincipal(principal_id) 84 if result != []: 85 # If there are local roles defined here, no additional 86 # lookup is done. 87 return result 88 # The principal has no local roles yet. Let's lookup the 89 # connected course, dept, etc. 90 obj = getattr(self._context, self.extra_attrib, None) 91 # Lookup local roles for connected course and all parent 92 # objects. This way we fake 'role inheritance'. 93 while obj is not None: 94 extra_roles = IPrincipalRoleManager(obj).getRolesForPrincipal( 95 principal_id) 96 for role_id, setting in extra_roles: 97 if role_id in self.rolename_mapping.keys(): 98 # Grant additional role 99 # permissions (allow, deny or unset) 100 # according to the rolename mapping above. 101 result.append( 102 (self.rolename_mapping[role_id], setting)) 103 return result 104 obj = getattr(obj, '__parent__', None) 105 return result -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/export.py
r8724 r9209 83 83 elif name == 'history': 84 84 value = value.messages 85 elif name == 'phone' and value is not None: 86 # Append hash '#' to phone numbers to circumvent 87 # unwanted excel automatic 88 value = str('%s#' % value) 85 89 return super( 86 90 ApplicantsExporter, self).mangle_value( -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/interfaces.py
r9004 r9209 18 18 """Interfaces of the university application package. 19 19 """ 20 from datetime import datetime 20 21 from grokcore.content.interfaces import IContainer 21 22 from zc.sourcefactory.contextual import BasicContextualSourceFactory … … 29 30 from waeup.kofa.schema import TextLineChoice, FormattedDate 30 31 from waeup.kofa.interfaces import ( 31 IKofaObject, year_range,validate_email,32 IKofaObject, validate_email, 32 33 SimpleKofaVocabulary) 33 34 from waeup.kofa.interfaces import MessageFactory as _ … … 41 42 42 43 _marker = object() # a marker different from None 44 45 def year_range(): 46 curr_year = datetime.now().year 47 return range(curr_year - 2, curr_year + 5) 43 48 44 49 class RegNumInSource(ValidationError): … … 323 328 application_number = Attribute('The key under which the record is stored') 324 329 330 suspended = schema.Bool( 331 title = _(u'Account suspended'), 332 default = False, 333 required = False, 334 ) 335 325 336 applicant_id = schema.TextLine( 326 337 title = _(u'Applicant Id'), … … 393 404 required = False, 394 405 ) 395 screening_venue = schema.TextLine(396 title = _(u'Screening Venue'),397 required = False,398 )399 screening_score = schema.Int(400 title = _(u'Screening Score'),401 required = False,402 )403 406 student_id = schema.TextLine( 404 407 title = _(u'Student Id'), … … 460 463 required = False, 461 464 ) 462 screening_score = schema.Int(463 title = _(u'Screening Score'),464 required = False,465 readonly = True,466 )467 screening_venue = schema.TextLine(468 title = _(u'Screening Venue'),469 required = False,470 readonly = True,471 )472 465 course_admitted = schema.Choice( 473 466 title = _(u'Admitted Course of Study'), -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/tests/test_applicantcopier.py
r8667 r9209 21 21 import os 22 22 import grok 23 from datetime import datetime 23 24 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 24 25 from zope.event import notify … … 28 29 from waeup.kofa.interfaces import IExtFileStore, IFileStoreNameChooser 29 30 from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup 31 32 session = datetime.now().year - 2 30 33 31 34 class ApplicantCopierFunctionalTests(ApplicantsFullSetup): … … 67 70 self.browser.getControl(name="form.course_admitted").value = ['CERT1'] 68 71 self.browser.getControl("Save").click() 72 # Maybe the certificate has meanwhile been removed 73 del self.app['faculties']['fac1']['dep1'].certificates['CERT1'] 74 (success, msg) = self.applicant.createStudent() 75 self.assertFalse(success) 76 self.assertTrue('ConstraintNotSatisfied: CERT1' in msg) 77 # Ok, lets add the certificate and try again 78 self.app['faculties']['fac1']['dep1'].certificates.addCertificate( 79 self.certificate) 69 80 (success, msg) = self.applicant.createStudent() 70 81 self.assertTrue('created' in msg) … … 82 93 self.assertEqual(student.firstname, 'John') 83 94 self.assertEqual(student.lastname, 'Tester') 95 # student_id set in application record? 96 self.assertEqual(self.applicant.student_id, student.student_id) 84 97 # Check if passport image has been copied 85 98 storage = getUtility(IExtFileStore) … … 110 123 # Has the student studycourse the correct attributes? 111 124 self.assertEqual(student['studycourse'].certificate.code, 'CERT1') 112 self.assertEqual(student['studycourse'].entry_session, 2009)125 self.assertEqual(student['studycourse'].entry_session, session) 113 126 self.assertEqual(student['studycourse'].entry_mode, 'ug_ft') 114 self.assertEqual(student['studycourse'].current_session, 2009)127 self.assertEqual(student['studycourse'].current_session, session) 115 128 self.assertEqual(student['studycourse'].current_level, 100) 116 129 -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/tests/test_authentication.py
r8351 r9209 64 64 email = None 65 65 phone = None 66 suspended = False 66 67 67 68 -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/tests/test_browser.py
r8778 r9209 23 23 import tempfile 24 24 import grok 25 from datetime import datetime 25 26 from StringIO import StringIO 26 27 from datetime import datetime, date, timedelta … … 46 47 PH_LEN = 2059 # Length of placeholder file 47 48 49 session_1 = datetime.now().year - 2 50 container_name_1 = u'app%s' % session_1 51 session_2 = datetime.now().year - 1 52 container_name_2 = u'app%s' % session_2 53 48 54 class ApplicantsFullSetup(FunctionalTestCase): 49 55 # A test case that only contains a setup and teardown … … 80 86 self.manage_root_path = self.root_path + '/@@manage' 81 87 self.add_container_path = self.root_path + '/@@add' 82 self.container_path = 'http://localhost/app/applicants/ app2009'88 self.container_path = 'http://localhost/app/applicants/%s' % container_name_1 83 89 self.manage_container_path = self.container_path + '/@@manage' 84 90 85 91 # Add an applicants container 86 92 applicantscontainer = ApplicantsContainer() 87 applicantscontainer.code = u'app2009'93 applicantscontainer.code = container_name_1 88 94 applicantscontainer.prefix = 'app' 89 applicantscontainer.year = 200990 applicantscontainer.title = u'This is the app2009 container'95 applicantscontainer.year = session_1 96 applicantscontainer.title = u'This is the %s container' % container_name_1 91 97 applicantscontainer.application_category = 'basic' 92 98 applicantscontainer.mode = 'create' … … 95 101 applicantscontainer.startdate = datetime.now(pytz.utc) - delta 96 102 applicantscontainer.enddate = datetime.now(pytz.utc) + delta 97 self.app['applicants'][ 'app2009'] = applicantscontainer98 self.applicantscontainer = self.app['applicants'][ 'app2009']103 self.app['applicants'][container_name_1] = applicantscontainer 104 self.applicantscontainer = self.app['applicants'][container_name_1] 99 105 100 106 # Populate university … … 135 141 self.applicant.reg_number = u'1234' 136 142 self.applicant.course1 = certificate 137 app['applicants'][ 'app2009'].addApplicant(self.applicant)143 app['applicants'][container_name_1].addApplicant(self.applicant) 138 144 IUserAccount( 139 self.app['applicants'][ 'app2009'][145 self.app['applicants'][container_name_1][ 140 146 self.applicant.application_number]).setPassword('apwd') 141 147 self.manage_path = 'http://localhost/app/applicants/%s/%s/%s' % ( 142 'app2009', self.applicant.application_number, 'manage')148 container_name_1, self.applicant.application_number, 'manage') 143 149 self.edit_path = 'http://localhost/app/applicants/%s/%s/%s' % ( 144 'app2009', self.applicant.application_number, 'edit')150 container_name_1, self.applicant.application_number, 'edit') 145 151 self.view_path = 'http://localhost/app/applicants/%s/%s' % ( 146 'app2009', self.applicant.application_number)152 container_name_1, self.applicant.application_number) 147 153 148 154 def login(self): … … 303 309 'There were errors' in self.browser.contents) 304 310 self.browser.getControl(name="form.prefix").value = ['app'] 305 self.browser.getControl(name="form.year").value = [ '2010']311 self.browser.getControl(name="form.year").value = [str(session_2)] 306 312 self.browser.getControl(name="form.mode").value = ['create'] 307 313 self.browser.getControl( … … 317 323 self.browser.open(self.add_container_path) 318 324 self.browser.getControl(name="form.prefix").value = ['app'] 319 self.browser.getControl(name="form.year").value = [ '2010']325 self.browser.getControl(name="form.year").value = [str(session_2)] 320 326 self.browser.getControl(name="form.mode").value = ['create'] 321 327 self.browser.getControl( … … 326 332 self.browser.open(self.manage_root_path) 327 333 ctrl = self.browser.getControl(name='val_id') 328 ctrl.getControl(value= 'app2010').selected = True334 ctrl.getControl(value=container_name_2).selected = True 329 335 self.browser.getControl("Remove selected", index=0).click() 330 336 self.assertTrue('Successfully removed:' in self.browser.contents) 331 337 self.browser.open(self.add_container_path) 332 338 self.browser.getControl(name="form.prefix").value = ['app'] 333 self.browser.getControl(name="form.year").value = [ '2010']339 self.browser.getControl(name="form.year").value = [str(session_2)] 334 340 self.browser.getControl(name="form.mode").value = ['create'] 335 341 #self.browser.getControl(name="form.ac_prefix").value = ['APP'] … … 337 343 name="form.application_category").value = ['basic'] 338 344 self.browser.getControl("Add applicants container").click() 339 del self.app['applicants'][ 'app2010']345 del self.app['applicants'][container_name_2] 340 346 ctrl = self.browser.getControl(name='val_id') 341 ctrl.getControl(value= 'app2010').selected = True347 ctrl.getControl(value=container_name_2).selected = True 342 348 self.browser.getControl("Remove selected", index=0).click() 343 349 self.assertMatches('...Could not delete...', self.browser.contents) … … 465 471 self.browser.open(self.slip_path) 466 472 self.assertTrue( 467 'Please pay before trying to download the application slip.'473 'Please pay and submit before trying to download the application slip.' 468 474 in self.browser.contents) 469 475 # If applicant is in correct state the pdf slip can be opened. 470 IWorkflowState(self.applicant).setState(' paid')476 IWorkflowState(self.applicant).setState('submitted') 471 477 self.browser.open(self.manage_path) 472 478 self.browser.getLink("Download application slip").click() … … 493 499 self.browser.headers['content-length'], str(PH_LEN)) 494 500 501 def test_applicant_login(self): 502 self.applicant.suspended = True 503 self.login() 504 self.assertTrue( 505 'You entered invalid credentials.' in self.browser.contents) 506 self.applicant.suspended = False 507 self.browser.getControl("Login").click() 508 self.assertTrue( 509 'You logged in.' in self.browser.contents) 510 495 511 def test_applicant_access(self): 496 512 # Applicants can edit their record 497 513 self.browser.open(self.login_path) 498 514 self.login() 515 self.assertTrue( 516 'You logged in.' in self.browser.contents) 499 517 self.browser.open(self.edit_path) 500 518 self.assertTrue(self.browser.url != self.login_path) … … 699 717 in self.browser.contents) 700 718 configuration = SessionConfiguration() 701 configuration.academic_session = 2009719 configuration.academic_session = session_1 702 720 configuration.application_fee = 200.0 703 721 self.app['configuration'].addSessionConfiguration(configuration) … … 727 745 payment_id = self.applicant.keys()[0] 728 746 payment = self.applicant[payment_id] 729 self.assertEqual(payment.p_item,'This is the app2009 container')730 self.assertEqual(payment.p_session, 2009)747 self.assertEqual(payment.p_item,'This is the %s container' % container_name_1) 748 self.assertEqual(payment.p_session, session_1) 731 749 self.assertEqual(payment.p_category,'application') 732 750 self.assertEqual(payment.amount_auth,200.0) … … 821 839 self.browser.getControl("Final Submit").click() 822 840 self.assertTrue( 823 ' ... submitted ...' in self.browser.contents)841 'Application submitted' in self.browser.contents) 824 842 # ... or allow submission after deadline. 825 843 IWorkflowState(self.applicant).setState('paid') … … 830 848 self.browser.getControl("Final Submit").click() 831 849 self.assertTrue( 832 ' ... submitted ...' in self.browser.contents)850 'Application submitted' in self.browser.contents) 833 851 self.browser.goBack(count=1) 834 852 self.browser.getControl("Save").click() … … 917 935 self.browser.getControl(name="form.phone.area").value = '555' 918 936 self.browser.getControl(name="form.phone.ext").value = '6666666' 919 self.browser.getControl(" Getlogin credentials").click()937 self.browser.getControl("Send login credentials").click() 920 938 self.assertEqual(self.browser.url, 921 939 self.container_path + '/registration_complete?email=xx%40yy.zz') … … 944 962 self.browser.getControl(name="form.reg_number").value = 'anynumber' 945 963 self.browser.getControl(name="form.email").value = 'xx@yy.zz' 946 self.browser.getControl(" Getlogin credentials").click()964 self.browser.getControl("Send login credentials").click() 947 965 self.assertTrue('No application record found.' 948 966 in self.browser.contents) … … 954 972 self.browser.getControl(name="form.reg_number").value = '1234' 955 973 self.browser.getControl(name="form.email").value = 'xx@yy.zz' 956 self.browser.getControl(" Getlogin credentials").click()974 self.browser.getControl("Send login credentials").click() 957 975 self.assertTrue('An error occurred.' in self.browser.contents) 958 976 # Let's set this attribute manually … … 963 981 self.browser.getControl(name="form.reg_number").value = '1234' 964 982 self.browser.getControl(name="form.email").value = 'xx@yy.zz' 965 self.browser.getControl(" Getlogin credentials").click()983 self.browser.getControl("Send login credentials").click() 966 984 # Anonymous is not informed that firstname verification failed. 967 985 # It seems that the record doesn't exist. … … 973 991 self.browser.getControl(name="form.firstname").value = 'John' 974 992 self.browser.getControl(name="form.reg_number").value = '1234' 975 self.browser.getControl(" Getlogin credentials").click()993 self.browser.getControl("Send login credentials").click() 976 994 self.assertTrue('Your password has already been set and used.' 977 995 in self.browser.contents) 978 996 #IUserAccount( 979 # self.app['applicants'][ 'app2009'][997 # self.app['applicants'][container_name_1][ 980 998 # self.applicant.application_number]).context.password = None 981 999 # Even without unsetting the password we can re-register if state … … 987 1005 self.browser.getControl(name="form.reg_number").value = '1234' 988 1006 self.browser.getControl(name="form.email").value = 'new@yy.zz' 989 self.browser.getControl(" Getlogin credentials").click()1007 self.browser.getControl("Send login credentials").click() 990 1008 # Yeah, we succeded ... 991 1009 self.assertTrue('Your registration was successful.' … … 1003 1021 self.browser.getControl(name="form.identifier").value = '1234' 1004 1022 self.browser.getControl(name="form.email").value = 'aa@aa.ng' 1005 self.browser.getControl(" Getlogin credentials").click()1023 self.browser.getControl("Send login credentials").click() 1006 1024 self.assertTrue('No record found' in self.browser.contents) 1007 1025 self.applicant.email = 'aa@aa.ng' … … 1011 1029 self.browser.getControl(name="form.identifier").value = '1234' 1012 1030 self.browser.getControl(name="form.email").value = 'aa@aa.ng' 1013 self.browser.getControl(" Getlogin credentials").click()1031 self.browser.getControl("Send login credentials").click() 1014 1032 self.assertTrue( 1015 1033 'An email with your user name and password has been sent' -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/tests/test_export.py
r8724 r9209 120 120 applicant.course_admitted = self.certificate 121 121 applicant.notice = u'Some notice\nin lines.' 122 applicant.screening_score = 98123 applicant.screening_venue = u'Exam Room'124 122 applicant.password = 'any password' 125 123 result_entry = ResultEntry( … … 144 142 'course_admitted,date_of_birth,display_fullname,email,firstname,' 145 143 'history,lastname,locked,middlename,notice,password,phone,' 146 'reg_number,s creening_score,screening_venue,sex,state,'147 'student_id, container_code\r\n'144 'reg_number,sex,state,' 145 'student_id,suspended,container_code\r\n' 148 146 'dp2011_654321,,654321,,,,,Anna Tester,,Anna,' 149 147 in result) 150 148 self.assertTrue( 151 149 'Application initialized by system\'],Tester,' 152 '0,,,,,,, ,,initialized,,dp2011\r\n'150 '0,,,,,,,initialized,,0,dp2011\r\n' 153 151 in result) 154 152 return … … 168 166 'course_admitted,date_of_birth,display_fullname,email,firstname,' 169 167 'history,lastname,locked,middlename,notice,password,phone,' 170 'reg_number,s creening_score,screening_venue,sex,state,'171 'student_id, container_code\r\n'168 'reg_number,sex,state,' 169 'student_id,suspended,container_code\r\n' 172 170 'dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,' 173 171 'Anna M. Tester,anna@sample.com,Anna,' … … 176 174 'Application initialized by system\'],' 177 175 'Tester,0,M.,"Some notice\nin lines.",any password,' 178 '+234-123-12345 ,123456,98,Exam Room,f,initialized,,dp2011\r\n'176 '+234-123-12345#,123456,f,initialized,,0,dp2011\r\n' 179 177 in result) 180 178 … … 192 190 'course_admitted,date_of_birth,display_fullname,email,firstname,' 193 191 'history,lastname,locked,middlename,notice,password,phone,' 194 'reg_number,s creening_score,screening_venue,sex,state,'195 'student_id, container_code\r\n'192 'reg_number,sex,state,' 193 'student_id,suspended,container_code\r\n' 196 194 'dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,' 197 195 'Anna M. Tester,anna@sample.com,Anna,' … … 200 198 'Application initialized by system\'],' 201 199 'Tester,0,M.,"Some notice\nin lines.",any password,' 202 '+234-123-12345 ,123456,98,Exam Room,f,initialized,,dp2011\r\n'203 in result) 204 return 200 '+234-123-12345#,123456,f,initialized,,0,dp2011\r\n' 201 in result) 202 return -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/utils.py
r8664 r9209 39 39 SEPARATORS_DICT = { 40 40 'form.course1': _(u'Desired Study Courses'), 41 'form.s creening_score': _(u'Process Data'),41 'form.student_id': _(u'Process Data'), 42 42 } 43 43 … … 45 45 """Set the payment data of an applicant. 46 46 """ 47 timestamp = "%d" % int(time()*1000)47 timestamp = ("%d" % int(time()*10000))[1:] 48 48 container_fee = container.application_fee 49 49 if container_fee: -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/viewlets.py
r8684 r9209 183 183 """Get a URL to the target... 184 184 """ 185 if self.context.state in ('initialized', 'started' ):185 if self.context.state in ('initialized', 'started', 'paid'): 186 186 return 187 187 return self.view.url(self.view.context, self.target) … … 204 204 205 205 class PaymentReceiptActionButton(ManageActionButton): 206 grok.order( 1)206 grok.order(9) # This button should always be the last one. 207 207 grok.context(IApplicantOnlinePayment) 208 208 grok.view(OnlinePaymentDisplayFormPage) … … 219 219 220 220 class ApprovePaymentActionButton(ManageActionButton): 221 grok.order( 2)221 grok.order(8) 222 222 grok.context(IApplicantOnlinePayment) 223 223 grok.view(OnlinePaymentDisplayFormPage) -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/workflow.py
r8752 r9209 150 150 source = PAID, 151 151 destination = STARTED), 152 Transition( 153 transition_id = 'reset7', 154 title = _('Reset application to admitted'), 155 msg = _('Application reset to admitted'), 156 source = CREATED, 157 destination = ADMITTED), 152 158 ) 153 159
Note: See TracChangeset for help on using the changeset viewer.