Index: /main/waeup.sirp/branches/ulif-fasttables/src/waeup/sirp/jambtables/browser.py
===================================================================
--- /main/waeup.sirp/branches/ulif-fasttables/src/waeup/sirp/jambtables/browser.py	(revision 5319)
+++ /main/waeup.sirp/branches/ulif-fasttables/src/waeup/sirp/jambtables/browser.py	(revision 5320)
@@ -27,4 +27,5 @@
     WAeUPPage, WAeUPEditFormPage, WAeUPAddFormPage,
     WAeUPDisplayFormPage, NullValidator)
+from waeup.sirp.interfaces import IWAeUPObject
 from waeup.sirp.jambtables import JAMBDataTable
 from waeup.sirp.jambtables.interfaces import IApplicant, IApplicantContainer
@@ -38,4 +39,5 @@
 from waeup.sirp.widgets.multilistwidget import (
     MultiListWidget, MultiListDisplayWidget)
+
 results_widget = CustomWidgetFactory(
     WAeUPObjectWidget, ResultEntry)
@@ -119,2 +121,67 @@
         self.redirect(self.url(self.context))
         return
+
+class Login_PDE(WAeUPPage):
+    grok.context(IWAeUPObject)
+    grok.name('login_pde')
+
+    title = 'PDE Login'
+    pnav = 1
+
+    def update(self, reg_no=None, ac_series=None, ac_number=None):
+        """Validate credentials and redirect or show error.
+
+        XXX: log things happening here
+        XXX: consider real login procedure with single applicant user.
+        """
+        self.reg_no = reg_no
+        self.ac_series = ac_series
+        self.ac_number = ac_number
+        for param in [reg_no, ac_series, ac_number]:
+            if param is None:
+                return
+        ac = "PUDE-%s-%s" % (ac_series, ac_number)
+        data = self.getApplicantData(reg_no, ac)
+        if data is None:
+            self.flash('Invalid data entered')
+            return
+        applicant_data, access_code = data
+        app_page = self.url(applicant_data, '@@edit')
+        # XXX: Invalidate ACCESS_CODE
+        self.redirect(app_page)
+        return
+
+    def getCurrentSession(self):
+        """Get the current session.
+
+        XXX: This should be computed or retrieved from elsewhere.
+        """
+        return u'2010/2011'
+
+    def getDeadline(self):
+        """Get application submission deadline.
+
+        XXX: This should be computed or retrieved from elsewhere.
+        """
+        return u"""Application submission deadline is at Midnight on Friday,
+                   01. October 2010. No application will be treated
+                   after the deadline."""
+
+    def getApplicantData(self, reg_no, ac):
+        """Validate credentials and return applicant data.
+
+        Returns tuple ``(<APPLICANT_ENTRY>, <ACCESSCODE>) on
+        successful validation and ``None`` else.
+
+        We expect a JAMB registration number and an access code in
+        format ``PUDE-XXX-XXXXXXXXXX``.
+        """
+        site = grok.getSite()
+        if reg_no not in site['applications'].keys():
+            return None
+        applicant_data = site['applications'][reg_no]
+        entries = site['accesscodes'].search(ac, 'pin')
+        if len(entries) != 1:
+            # XXX: If entries > 1 then we have a problem!
+            return None
+        return (applicant_data, entries[0])
