Changeset 7249 for main/waeup.sirp/trunk


Ignore:
Timestamp:
1 Dec 2011, 15:41:31 (13 years ago)
Author:
Henrik Bettermann
Message:

ApplicantLoginPage? not used anymore.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py

    r7247 r7249  
    405405    def delLocalRoles(self, **data):
    406406        return del_local_roles(self,3,**data)
    407 
    408 # Not used anymore
    409 class ApplicantLoginPage(WAeUPPage):
    410     grok.context(IApplicantsContainer)
    411     grok.name('login')
    412     grok.require('waeup.Public')
    413 
    414     @property
    415     def title(self):
    416         return u"Applicant Login: %s" % self.context.title
    417 
    418     @property
    419     def label(self):
    420         return u"Login for '%s' applicants only" % self.context.title
    421 
    422     pnav = 3
    423 
    424     @property
    425     def ac_prefix(self):
    426         return self.context.ac_prefix
    427 
    428     def update(self, SUBMIT=None):
    429         self.ac_series = self.request.form.get('form.ac_series', None)
    430         self.ac_number = self.request.form.get('form.ac_number', None)
    431         if SUBMIT is None:
    432             return
    433         if self.request.principal.id == 'zope.anybody':
    434             self.flash('Entered credentials are invalid.')
    435             return
    436 #        if not IApplicantPrincipal.providedBy(self.request.principal):
    437 #            # Don't care if user is already authenticated as non-applicant
    438             return
    439 
    440         # From here we handle an applicant (not an officer browsing)
    441         pin = self.request.principal.access_code
    442 
    443         # If application has not yet started,
    444         # logout without marking AC as used
    445         if not self.context.startdate or self.context.startdate > date.today():
    446             self.flash('Application has not yet started.')
    447             auth = getUtility(IAuthentication)
    448             ILogout(auth).logout(self.request)
    449             self.redirect(self.url(self.context, 'login'))
    450             return
    451 
    452         # If application has ended and applicant record doesn't exist,
    453         # logout without marking AC as used
    454         if not pin in self.context.keys() and (not self.context.enddate or
    455                                         self.context.enddate < date.today()):
    456             self.flash('Application has ended.')
    457             auth = getUtility(IAuthentication)
    458             ILogout(auth).logout(self.request)
    459             self.redirect(self.url(self.context, 'login'))
    460             return
    461 
    462         # Mark AC as used (this also fires a pin related transition)
    463         if get_access_code(pin).state != USED:
    464             comment = u"AC invalidated"
    465             # Here we know that the ac is in state initialized so we do not
    466             # expect an exception
    467             invalidate_accesscode(pin,comment)
    468 
    469         if not pin in self.context.keys():
    470             # Create applicant record
    471             applicant = Applicant()
    472             applicant.access_code = pin
    473             self.context[pin] = applicant
    474 
    475         role_manager = IPrincipalRoleManager(self.context[pin])
    476         role_manager.assignRoleToPrincipal(
    477             'waeup.local.ApplicationOwner', self.request.principal.id)
    478 
    479         # Assign current principal the global Applicant role
    480         role_manager = IPrincipalRoleManager(grok.getSite())
    481         role_manager.assignRoleToPrincipal(
    482             'waeup.Applicant', self.request.principal.id)
    483 
    484         # Mark application as started
    485         #if IWorkflowState(self.context[pin]).getState() is INITIALIZED:
    486         #    IWorkflowInfo(self.context[pin]).fireTransition('start')
    487 
    488         self.redirect(self.url(self.context[pin], 'edit'))
    489         return
    490 
    491     def render(self):
    492         return
    493407
    494408class ApplicantAddFormPage(WAeUPAddFormPage):
Note: See TracChangeset for help on using the changeset viewer.