Changeset 7262 for main/waeup.sirp/trunk/src
- Timestamp:
- 4 Dec 2011, 08:36:14 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/batching.py
r7192 r7262 22 22 from waeup.sirp.interfaces import IBatchProcessor 23 23 from waeup.sirp.utils.batching import BatchProcessor 24 from waeup.sirp.applicants.interfaces import IApplicantsContainer 24 from waeup.sirp.applicants.interfaces import ( 25 IApplicantsContainer, IApplicant) 25 26 26 27 class ApplicantsContainerImporter(BatchProcessor): … … 64 65 del parent[row['code']] 65 66 return 67 68 class ApplicantProcessor(BatchProcessor): 69 """A batch processor for IApplicant objects. 70 """ 71 grok.implements(IBatchProcessor) 72 grok.provides(IBatchProcessor) 73 grok.context(Interface) 74 util_name = 'applicantimporter' 75 grok.name(util_name) 76 name = u'Applicant Importer' 77 iface = IApplicant 78 location_fields = [] 79 factory_name = 'waeup.Applicant' 80 location_fields = ['container_code', 'application_number'] 81 82 mode = None 83 84 @property 85 def req(self): 86 result = dict( 87 create = ['container_code'] + self.required_fields, 88 update = self.location_fields, 89 remove = self.location_fields, 90 ) 91 return result 92 93 def parentsExist(self, row, site): 94 if not 'applicants' in site.keys(): 95 return False 96 return row['container_code'] in site['applicants'].keys() 97 98 def entryExists(self, row, site): 99 if not self.parentsExist(row, site): 100 return None 101 parent = self.getParent(row, site) 102 if 'application_number' in row.keys() and row['application_number']: 103 if row['application_number'] in parent.keys(): 104 return parent[row['application_number']] 105 return None 106 107 def getParent(self, row, site): 108 return site['applicants'][row['container_code']] 109 110 def getEntry(self, row, site): 111 return self.entryExists(row, site) 112 113 def addEntry(self, obj, row, site): 114 parent = self.getParent(row, site) 115 parent.addApplicant(obj) 116 return 117 118 def delEntry(self, row, site): 119 applicant = self.entryExists(row, site) 120 if applicant: 121 parent = self.getParent(row, site) 122 del parent[row['application_number']] 123 pass -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py
r7260 r7262 259 259 readonly = False, 260 260 ) 261 262 261 reg_no = schema.TextLine( 263 262 title = u'JAMB Registration Number', … … 269 268 required = False, 270 269 readonly = True, 271 )272 course1 = schema.Choice(273 title = u'1st Choice Course of Study',274 source = AppCatCertificateSource(),275 required = True,276 )277 course2 = schema.Choice(278 title = u'2nd Choice Course of Study',279 source = AppCatCertificateSource(),280 required = False,281 270 ) 282 271 firstname = schema.TextLine( … … 318 307 required = False, 319 308 ) 320 #passport = ImageFile( 321 # title = u'Passport Photograph', 322 # #default = DEFAULT_PASSPORT_IMAGE_MALE, 323 # defaultFactory = default_passport_image, 324 # description = u'Maximun file size is 20 kB.', 325 # required = True, 326 # max_size = 20480, 327 # ) 309 course1 = schema.Choice( 310 title = u'1st Choice Course of Study', 311 source = CertificateSource(), 312 required = True, 313 ) 314 course2 = schema.Choice( 315 title = u'2nd Choice Course of Study', 316 source = CertificateSource(), 317 required = False, 318 ) 328 319 329 320 # … … 371 362 Here we can repeat the fields from base data and set the 372 363 `required` and `readonly` attributes to True to further restrict 373 the data access. We cannot omit fields. This has to be done in the 364 the data access. Or we can allow only certain certificates to be 365 selected by choosing the appropriate source. 366 367 We cannot omit fields here. This has to be done in the 374 368 respective form page. 375 369 """ 370 371 course1 = schema.Choice( 372 title = u'1st Choice Course of Study', 373 source = AppCatCertificateSource(), 374 required = True, 375 ) 376 course2 = schema.Choice( 377 title = u'2nd Choice Course of Study', 378 source = AppCatCertificateSource(), 379 required = False, 380 ) 376 381 screening_score = schema.Int( 377 382 title = u'Screening Score', -
main/waeup.sirp/trunk/src/waeup/sirp/browser/batchprocessing.txt
r6837 r7262 93 93 >>> importerselect = browser.getControl(name='importer') 94 94 >>> importerselect.displayOptions 95 ['Applicants Container Importer', 95 ['Applicant Importer', 96 'Applicants Container Importer', 96 97 'Student Importer', 97 98 'StudentStudyCourse Importer (update only)',
Note: See TracChangeset for help on using the changeset viewer.