Changeset 5758
- Timestamp:
- 13 Feb 2011, 12:20:24 (14 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/applicants
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py
r5753 r5758 25 25 import waeup.sirp.browser 26 26 from hurry.file import HurryFile 27 from zc.sourcefactory.basic import BasicSourceFactory 27 28 from zope import schema 28 from zc.sourcefactory.basic import BasicSourceFactory 29 from zope.interface import Interface, Attribute 30 from zope.pluggableauth.interfaces import IPrincipalInfo 31 from zope.security.interfaces import IGroupClosureAwarePrincipal as IPrincipal 29 32 from waeup.sirp.image.schema import ImageFile 30 33 from waeup.sirp.interfaces import IWAeUPObject, SimpleWAeUPVocabulary … … 688 691 required = True, 689 692 ) 693 694 class IApplicantPrincipalInfo(IPrincipalInfo): 695 """Infos about principals that are applicants. 696 """ 697 reg_no = Attribute("The JAMB registration no. of the user") 698 699 access_code = Attribute("The Access Code the user purchased") 700 701 class IApplicantPrincipal(IPrincipal): 702 """A principal that is an applicant. 703 704 This interface extends zope.security.interfaces.IPrincipal and 705 requires also an `id` and other attributes defined there. 706 """ 707 reg_no = schema.TextLine( 708 title = u'Registration number', 709 description = u'The JAMB registration number', 710 required = True, 711 readonly = True) 712 713 access_code = schema.TextLine( 714 title = u'Access Code', 715 description = u'The access code purchased by the user.', 716 required = True, 717 readonly = True) 718 719 class IApplicantsFormChallenger(Interface): 720 """A challenger that uses a browser form to collect applicant 721 credentials. 722 """ 723 loginpagename = schema.TextLine( 724 title = u'Loginpagename', 725 description = u"""Name of the login form used by challenger. 726 727 The form must provide an ``access_code`` input field. 728 """) 729 730 accesscode_field = schema.TextLine( 731 title = u'Access code field', 732 description = u'''Field of the login page which is looked up for 733 access_code''', 734 default = u'access_code', 735 ) 736 737 class IJAMBApplicantsFormChallenger(IApplicantsFormChallenger): 738 """A challenger that uses a browser form to collect applicant 739 credentials for applicants in JAMB process. 740 741 JAMB-screened applicants have to provide an extra registration 742 no. provided by JAMB. 743 """ 744 jamb_reg_no_field = schema.TextLine( 745 title = u'JAMB registration no.', 746 description = u'''Field of the login page which is looked up for 747 the JAMB registration number.''', 748 default = u'jamb_reg_no', 749 ) 750 751 class IApplicantSessionCredentials(Interface): 752 """Interface for storing and accessing applicant credentials in a 753 session. 754 """ 755 756 def __init__(access_code): 757 """Create applicant session credentials.""" 758 759 def getAccessCode(): 760 """Return the access code.""" 761 762 763 class IJAMBApplicantSessionCredentials(IApplicantSessionCredentials): 764 """Interface for storing and accessing JAMB applicant credentials in a 765 session. 766 """ 767 768 def __init__(access_code, jamb_reg_no): 769 """Create credentials for JAMB screened applicants.""" 770 771 def getJAMBRegNo(): 772 """Return the JAMB registration no.""" -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/jambtables/browser.py
r5746 r5758 31 31 from waeup.sirp.interfaces import IWAeUPObject 32 32 from waeup.sirp.applicants.jambtables.util import get_applicant_data 33 from waeup.sirp.applicants. jambtables.interfaces import (34 IApplicant, IApplicant Container, IApplicantPrincipal, IApplicantPDEEditData)33 from waeup.sirp.applicants.interfaces import ( 34 IApplicant, IApplicantPrincipal, IApplicantPDEEditData) 35 35 from waeup.sirp.widgets.passportwidget import ( 36 36 PassportWidget, PassportDisplayWidget … … 39 39 from zope.formlib.sequencewidget import ListSequenceWidget, SequenceDisplayWidget 40 40 from zope.formlib.widget import CustomWidgetFactory 41 from waeup.sirp.applicants .jambtables.applicantsimport ResultEntry41 from waeup.sirp.applicants import ResultEntry 42 42 from waeup.sirp.widgets.objectwidget import ( 43 43 WAeUPObjectWidget, WAeUPObjectDisplayWidget) … … 63 63 MultiListDisplayWidget, subwidget=results_display_widget) 64 64 65 class ApplicationsPage(WAeUPPage):66 grok.context(IApplicantContainer)67 grok.name('index')68 title = 'Applications'69 pnav = 170 71 def getApplications(self):72 """Get a list of all stored applications.73 """74 for key, val in self.context.items():75 url = self.url(val)76 yield(dict(url=url, name=key))77 78 class AddApplicant(WAeUPAddFormPage):79 grok.context(IApplicantContainer)80 grok.name('add')81 form_fields = grok.AutoFields(IApplicant)82 form_fields['fst_sit_results'].custom_widget = list_results_widget83 form_fields['passport'].custom_widget = EncodingImageFileWidget84 label = 'Add Applicant'85 title = 'Add Applicant'86 pnav = 187 88 @grok.action('Add applicant')89 def addApplicant(self, **data):90 from waeup.sirp.jambtables.applicants import Applicant91 applicant = Applicant()92 self.applyData(applicant, **data)93 # XXX: temporarily disabled.94 #self.context[applicant.reg_no] = applicant95 try:96 self.context[applicant.access_code] = applicant97 except KeyError:98 self.flash('The given access code is already in use!')99 return100 self.redirect(self.url(self.context))65 #class ApplicationsPage(WAeUPPage): 66 # grok.context(IApplicantContainer) 67 # grok.name('index') 68 # title = 'Applications' 69 # pnav = 1 70 # 71 # def getApplications(self): 72 # """Get a list of all stored applications. 73 # """ 74 # for key, val in self.context.items(): 75 # url = self.url(val) 76 # yield(dict(url=url, name=key)) 77 78 #class AddApplicant(WAeUPAddFormPage): 79 # grok.context(IApplicantContainer) 80 # grok.name('add') 81 # form_fields = grok.AutoFields(IApplicant) 82 # form_fields['fst_sit_results'].custom_widget = list_results_widget 83 # form_fields['passport'].custom_widget = EncodingImageFileWidget 84 # label = 'Add Applicant' 85 # title = 'Add Applicant' 86 # pnav = 1 87 # 88 # @grok.action('Add applicant') 89 # def addApplicant(self, **data): 90 # from waeup.sirp.jambtables.applicants import Applicant 91 # applicant = Applicant() 92 # self.applyData(applicant, **data) 93 # # XXX: temporarily disabled. 94 # #self.context[applicant.reg_no] = applicant 95 # try: 96 # self.context[applicant.access_code] = applicant 97 # except KeyError: 98 # self.flash('The given access code is already in use!') 99 # return 100 # self.redirect(self.url(self.context)) 101 101 102 102 class DisplayApplicant(WAeUPDisplayFormPage): -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/jambtables/interfaces.py
r5757 r5758 39 39 """A container that holds JAMB data tables. 40 40 """ 41 42 41 43 42 class IApplicantPDEImportData(IApplicantBaseData):
Note: See TracChangeset for help on using the changeset viewer.