Index: /main/waeup.sirp/trunk/src/waeup/sirp/applicants/applicants.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/applicants/applicants.py	(revision 6594)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/applicants/applicants.py	(revision 6595)
@@ -106,5 +106,4 @@
             if self.context.passport is not None:
                 return self.context.passport
-            return default_passport_image(self.context)
         return
 
Index: /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py	(revision 6594)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py	(revision 6595)
@@ -507,6 +507,6 @@
             applicant_object = get_applicant_data(access_code)
             return absoluteURL(applicant_object, self.request) + self.target
-        else:
-            return ''
+        #else:
+        #    return ''
 
 class AccessCodeEditLink(AccessCodeViewLink):
@@ -527,6 +527,6 @@
                 return ''
             return absoluteURL(applicant_object, self.request) + self.target
-        else:
-            return ''
+        #else:
+        #    return ''
 
 class AccessCodeSlipLink(AccessCodeViewLink):
@@ -769,4 +769,5 @@
     def update(self):
         if self.context.locked:
+            #import pdb; pdb.set_trace()
             self.emitLockMessage()
             return
@@ -778,13 +779,13 @@
         if not self.request.form.get('confirm_passport', False):
             return 'Passport confirmation box not ticked.'
-        if len(self.errors) > 0:
-            return 'Form has errors.'
+        #if len(self.errors) > 0:
+        #    return 'Form has errors.'
         return False
 
     @grok.action('Save')
     def save(self, **data):
-        if self.context.locked:
-            self.emitLockMessage()
-            return
+        #if self.context.locked:
+        #    self.emitLockMessage()
+        #    return
         self.applyData(self.context, **data)
         self.context._p_changed = True
@@ -794,7 +795,7 @@
     @grok.action('Final Submit')
     def finalsubmit(self, **data):
-        if self.context.locked:
-            self.emitLockMessage()
-            return
+        #if self.context.locked:
+        #    self.emitLockMessage()
+        #    return
         self.applyData(self.context, **data)
         self.context._p_changed = True
Index: /main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_browser.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_browser.py	(revision 6594)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_browser.py	(revision 6595)
@@ -30,4 +30,5 @@
 from zope.component.hooks import setSite, clearSite
 from zope.testbrowser.testing import Browser
+from hurry.workflow.interfaces import IWorkflowInfo
 from waeup.sirp.testing import FunctionalLayer, FunctionalTestCase
 from waeup.sirp.app import University
@@ -221,4 +222,7 @@
         self.browser.getControl("Add applicants container").click()
         self.assertTrue('Added:' in self.browser.contents)
+        self.browser.open(self.add_container_path)
+        self.browser.getControl("Cancel").click()
+        self.assertEqual(self.browser.url, self.manage_root_path + '#tab-1')
         self.browser.open(self.add_container_path)
         self.browser.getControl(name="form.prefix").value = ['app']
@@ -235,4 +239,17 @@
         self.browser.getControl("Remove selected", index=0).click()
         self.assertTrue('Successfully removed:' in self.browser.contents)
+        self.browser.open(self.add_container_path)
+        self.browser.getControl(name="form.prefix").value = ['app']
+        self.browser.getControl(name="form.year").value = ['2010']
+        self.browser.getControl(name="form.provider").value = [
+            'waeup.sirp.applicants.ApplicantsContainer']
+        self.browser.getControl(name="form.ac_prefix").value = ['APP']
+        self.browser.getControl(name="form.application_category").value = ['basic']
+        self.browser.getControl("Add applicants container").click()
+        del self.app['applicants']['app2010']
+        ctrl = self.browser.getControl(name='val_id')
+        ctrl.getControl(value='app2010').selected = True
+        self.browser.getControl("Remove selected", index=0).click()
+        self.assertMatches('...Could not delete...', self.browser.contents)
         return
 
@@ -261,4 +278,19 @@
         self.browser.getControl("Remove selected", index=0).click()
         self.assertTrue('Successfully removed:' in self.browser.contents)
+        self.browser.open(self.add_applicant_path)
+        existing_pin = self.pins[2]
+        parts = existing_pin.split('-')[1:]
+        existing_series, existing_number = parts
+        self.browser.getControl(name="form.ac_series").value = existing_series
+        self.browser.getControl(name="form.ac_number").value = existing_number
+        self.browser.getControl("Create application record").click()
+        self.assertTrue('Application initialized' in self.browser.contents)
+        self.browser.open(self.container_manage_path)
+        self.assertTrue(existing_pin in self.browser.contents)
+        del self.app['applicants']['app2009'][existing_pin]
+        ctrl = self.browser.getControl(name='val_id')
+        ctrl.getControl(value=existing_pin).selected = True
+        self.browser.getControl("Remove selected", index=0).click()
+        self.assertMatches('...Could not delete...', self.browser.contents)
         return
 
@@ -272,4 +304,8 @@
         self.browser.open(self.applicant_manage_path)
         self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        self.browser.getControl(name="form.email").value = 'abc'
+        self.browser.getControl("Save").click()
+        self.assertMatches('...Invalid email address...', self.browser.contents)
+        self.browser.getControl(name="form.email").value = 'abc@def.gh'
         self.browser.getControl(name="form.firstname").value = 'John'
         self.browser.getControl(name="form.lastname").value = 'Tester'
@@ -288,4 +324,10 @@
         self.assertEqual(self.browser.headers['Status'], '200 Ok')
         self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
+        self.browser.open(self.applicant_manage_path)
+        self.browser.getControl(name="form.course_admitted").value = []
+        self.browser.getControl("Save").click()
+        self.browser.open(self.applicant_slip_path)
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
         return
 
@@ -318,5 +360,4 @@
         ac_number.value = existing_number
         self.browser.getControl(name="SUBMIT").click()
-
         pin = self.pins[2]
         appl = self.getRootFolder()['app']['applicants']['app2009']
@@ -326,6 +367,4 @@
         passp_len = len(passp.file.read())
         self.assertEqual(passp_len, PH_LEN)
-
-
         #image_url = "%s/%s" % (self.browser.url, 'placeholder.jpg')
         image_url = "%s/%s" % (self.browser.url, 'passport.jpg')
@@ -334,6 +373,4 @@
         self.assertEqual(self.browser.headers['status'], '200 Ok')
         self.assertEqual(self.browser.headers['content-type'], 'image/jpeg')
-
-
         self.assertTrue('JFIF' in self.browser.contents)
         self.assertEqual(
@@ -745,7 +782,29 @@
             'Passport confirmation box not ticked' in self.browser.contents)
         self.browser.getControl(name="confirm_passport").value = True
+        IWorkflowInfo(self.applicant).fireTransition('submit')
         self.browser.getControl("Final Submit").click() # submit form again
         self.assertTrue(
+            'Wrong state' in self.browser.contents)
+        IWorkflowInfo(self.applicant).fireTransition('reset1')
+        # Now do the whole thing again but with correct state
+        self.login() 
+        self.fill_correct_values() 
+        pseudo_image = StringIO('I pretend to be a graphics file')
+        ctrl = self.browser.getControl(name='form.passport')
+        file_ctrl = ctrl.mech_control
+        file_ctrl.add_file(pseudo_image, filename='myphoto.jpg')
+        self.browser.getControl(name="confirm_passport").value = True
+        self.browser.getControl("Final Submit").click()
+        self.assertTrue(
             '... submitted ...' in self.browser.contents)
+        self.browser.goBack(count=1)
+        self.browser.getControl("Save").click()
+        self.assertTrue(
+            'The requested form is locked' in self.browser.contents)
+        self.browser.goBack(count=1)
+        #import pdb; pdb.set_trace()
+        self.browser.getControl("Final Submit").click()
+        self.assertTrue(
+            'The requested form is locked' in self.browser.contents)
         return
 
