- Timestamp:
- 19 Jun 2015, 15:36:21 (10 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/container.py
r10655 r13077 24 24 from datetime import datetime 25 25 import zope.location.location 26 from zope.component import getUtility 26 from zope.component import getUtility, ComponentLookupError 27 27 from zope.component.factory import Factory 28 28 from zope.component.interfaces import IFactory … … 53 53 grok.implements(IApplicantsContainer,IApplicantsContainerAdd) 54 54 55 #: A dictionary to hold per language translations of description string.56 55 description_dict = {} 57 56 58 57 local_roles = [] 59 60 def archive(self, app_ids=None):61 """Create on-dist archive of applicants stored in this term.62 63 If app_ids is `None`, all applicants are archived.64 65 If app_ids contains a single id string, only the respective66 applicants are archived.67 68 If app_ids contains a list of id strings all of the respective69 applicants types are saved to disk.70 """71 raise NotImplementedError()72 73 def clear(self, app_ids=None, archive=True):74 """Remove applicants of type given by 'id'.75 76 Optionally archive the applicants.77 78 If id is `None`, all applicants are archived.79 80 If id contains a single id string, only the respective81 applicants are archived.82 83 If id contains a list of id strings all of the respective84 applicant types are saved to disk.85 86 If `archive` is ``False`` none of the archive-handling is done87 and respective applicants are simply removed from the88 database.89 """90 raise NotImplementedError()91 58 92 59 def addApplicant(self, applicant): … … 104 71 @property 105 72 def statistics(self): 106 return getUtility(IApplicantsUtils).getApplicantsStatistics(self) 73 try: 74 statistics = getUtility( 75 IApplicantsUtils).getApplicantsStatistics(self) 76 except ComponentLookupError: # happens in unit tests 77 return 78 return statistics 107 79 108 80 @property … … 125 97 126 98 def traverse(self, name): 127 """Deliver appropriate containers.99 """Deliver virtual export container. 128 100 """ 129 101 if name == 'exports': -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/interfaces.py
r13076 r13077 149 149 """A collection of methods which are subject to customization. 150 150 """ 151 152 151 APP_TYPES_DICT = Attribute('dict of application types') 153 152 … … 169 168 170 169 class IApplicantsRoot(IKofaObject, IContainer): 171 """A container for university applicants containers. 172 """ 170 """A container for applicants containers. 171 """ 172 description_dict = Attribute('Language translation dictionary with values in HTML format') 173 local_roles = Attribute('List of local role names') 174 logger_name = Attribute('Name of the logger') 175 logger_filename = Attribute('Name of the logger file') 173 176 174 177 description = schema.Text( … … 182 185 ) 183 186 184 description_dict = Attribute(185 """Content as language dictionary with values in HTML format.""")186 187 187 class IApplicantsContainer(IKofaObject): 188 """An applicants container contains university applicants. 189 190 """ 188 """An applicants container contains applicants. 189 """ 190 statistics = Attribute('Applicant counts') 191 expired = Attribute('True if application has started but not ended') 192 193 description_dict = Attribute('Language translation dictionary with values in HTML format') 194 local_roles = Attribute('List of local role names') 195 191 196 192 197 code = schema.TextLine( … … 246 251 ) 247 252 248 description_dict = Attribute(249 """Content as language dictionary with values in HTML format.""")250 251 253 startdate = schema.Datetime( 252 254 title = _(u'Application Start Date'), … … 285 287 ) 286 288 287 def archive(id=None): 288 """Create on-dist archive of applicants stored in this term. 289 290 If id is `None`, all applicants are archived. 291 292 If id contains a single id string, only the respective 293 applicants are archived. 294 295 If id contains a list of id strings all of the respective 296 applicants types are saved to disk. 297 """ 298 299 def clear(id=None, archive=True): 300 """Remove applicants of type given by 'id'. 301 302 Optionally archive the applicants. 303 304 If id is `None`, all applicants are archived. 305 306 If id contains a single id string, only the respective 307 applicants are archived. 308 309 If id contains a list of id strings all of the respective 310 applicant types are saved to disk. 311 312 If `archive` is ``False`` none of the archive-handling is done 313 and respective applicants are simply removed from the 314 database. 289 def addApplicant(applicant): 290 """Add an applicant. 315 291 """ 316 292 317 293 def writeLogMessage(view, comment): 318 """Adds an INFO message to the log file 294 """Add an INFO message to the log file. 295 """ 296 297 def traverse(name): 298 """Deliver appropriate containers. 319 299 """ 320 300 … … 342 322 343 323 class IApplicantBaseData(IApplicantBase): 344 """The data for an applicant. 345 346 This is a base interface with no field 324 """This is a base interface of an applicant with no field 347 325 required. For use with processors, forms, etc., please use one of 348 326 the derived interfaces below, which set more fields to required 349 327 state, depending on use-case. 350 328 """ 351 352 329 history = Attribute('Object history, a list of messages') 353 330 state = Attribute('The application state of an applicant') … … 368 345 readonly = False, 369 346 ) 347 370 348 reg_number = TextLineChoice( 371 349 title = _(u'Registration Number'), … … 374 352 source = contextual_reg_num_source, 375 353 ) 376 #access_code = schema.TextLine( 377 # title = u'Activation Code', 378 # required = False, 379 # readonly = True, 380 # ) 354 381 355 firstname = schema.TextLine( 382 356 title = _(u'First Name'), 383 357 required = True, 384 358 ) 359 385 360 middlename = schema.TextLine( 386 361 title = _(u'Middle Name'), 387 362 required = False, 388 363 ) 364 389 365 lastname = schema.TextLine( 390 366 title = _(u'Last Name (Surname)'), 391 367 required = True, 392 368 ) 369 393 370 date_of_birth = FormattedDate( 394 371 title = _(u'Date of Birth'), 395 372 required = False, 396 #date_format = u'%d/%m/%Y', # Use grok-instance-wide default397 373 show_year = True, 398 374 ) 375 399 376 sex = schema.Choice( 400 377 title = _(u'Sex'), … … 402 379 required = True, 403 380 ) 381 404 382 email = schema.ASCIILine( 405 383 title = _(u'Email Address'), … … 407 385 constraint=validate_email, 408 386 ) 387 409 388 phone = PhoneNumber( 410 389 title = _(u'Phone'), … … 412 391 required = False, 413 392 ) 393 414 394 course1 = schema.Choice( 415 395 title = _(u'1st Choice Course of Study'), … … 417 397 required = True, 418 398 ) 399 419 400 course2 = schema.Choice( 420 401 title = _(u'2nd Choice Course of Study'), … … 422 403 required = False, 423 404 ) 405 424 406 #school_grades = schema.List( 425 407 # title = _(u'School Grades'), … … 456 438 457 439 class IApplicant(IApplicantBaseData): 458 """An applicant. 459 460 This is basically the applicant base data. Here we repeat the 440 """This is basically the applicant base data. Here we repeat the 461 441 fields from base data if we have to set the `required` attribute 462 442 to True (which is the default). … … 473 453 474 454 class ISpecialApplicant(IApplicantBase): 475 """A special applicant. 476 477 This reduced interface is for former students or students who are not 455 """This reduced interface is for former students or students who are not 478 456 student users of the portal but have to pay supplementary fees. 479 457 … … 482 460 only 'customize' fields. 483 461 """ 484 485 462 history = Attribute('Object history, a list of messages') 486 463 state = Attribute('The application state of an applicant') … … 557 534 558 535 class IApplicantEdit(IApplicant): 559 """ An applicant interface for editing.536 """This is an applicant interface for editing. 560 537 561 538 Here we can repeat the fields from base data and set the … … 573 550 constraint=validate_email, 574 551 ) 552 575 553 course1 = schema.Choice( 576 554 title = _(u'1st Choice Course of Study'), … … 578 556 required = True, 579 557 ) 558 580 559 course2 = schema.Choice( 581 560 title = _(u'2nd Choice Course of Study'), … … 583 562 required = False, 584 563 ) 564 585 565 course_admitted = schema.Choice( 586 566 title = _(u'Admitted Course of Study'), … … 589 569 readonly = True, 590 570 ) 571 591 572 notice = schema.Text( 592 573 title = _(u'Notice'), … … 599 580 600 581 class IApplicantUpdateByRegNo(IApplicant): 601 """Representation of an applicant. 602 603 Skip regular reg_number validation if reg_number is used for finding 582 """Skip regular reg_number validation if reg_number is used for finding 604 583 the applicant object. 605 584 """ … … 610 589 611 590 class IApplicantRegisterUpdate(IApplicant): 612 """Representation of an applicant for first-time registration. 613 591 """This is a representation of an applicant for first-time registration. 614 592 This interface is used when applicants use the registration page to 615 593 update their records. … … 643 621 def doAfterApplicantPayment(): 644 622 """Process applicant after payment was made. 645 646 623 """ 647 624 648 625 def doAfterApplicantPaymentApproval(): 649 626 """Process applicant after payment was approved. 650 651 627 """ 652 628 653 629 def approveApplicantPayment(): 654 630 """Approve payment and process applicant. 655 656 """ 631 """ -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/root.py
r8773 r13077 36 36 37 37 local_roles = [] 38 39 #: A dictionary to hold per language translations of description string.40 38 description_dict = {} 41 42 39 logger_name = 'waeup.kofa.${sitename}.applicants' 43 40 logger_filename = 'applicants.log' -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_container.py
r7811 r13077 40 40 return 41 41 42 def test_base(self):43 # We cannot call the fundamental methods of a base in that case44 container = ApplicantsContainer()45 self.assertRaises(46 NotImplementedError, container.archive)47 self.assertRaises(48 NotImplementedError, container.clear)49 50 42 def suite(): 51 43 suite = unittest.TestSuite() -
main/waeup.kofa/trunk/src/waeup/kofa/utils/helpers.py
r12974 r13077 811 811 """Transforms a localized HTML text string into a dictionary. 812 812 813 Different languages must be separated by ` >>xy<<` whereas813 Different languages must be separated by ``>>xy<<`` whereas 814 814 xy is the language code. Text parts without correct leading 815 815 language separator - usually the first part has no language 816 816 descriptor - are interpreted as texts in the portal's language. 817 The latter can be configured in waeup.srp.utils.utils.IkobaUtils.818 817 """ 819 818 try: … … 838 837 """Transforms a localized REST text string into a dictionary. 839 838 840 Different languages must be separated by ` >>xy<<` whereas839 Different languages must be separated by ``>>xy<<``` whereas 841 840 xy is the language code. Text parts without correct leading 842 841 language separator - usually the first part has no language 843 842 descriptor - are interpreted as texts in the portal's language. 844 The latter can be configured in waeup.srp.utils.utils.IkobaUtils.845 843 """ 846 844 try:
Note: See TracChangeset for help on using the changeset viewer.