Changeset 10095 for main/waeup.kofa/trunk/src/waeup/kofa/applicants
- Timestamp:
- 23 Apr 2013, 09:39:09 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/applicants
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py
r10094 r10095 796 796 self.wf_info = IWorkflowInfo(self.context) 797 797 self.max_upload_size = string_from_bytes(MAX_UPLOAD_SIZE) 798 self.files_uploaded = []799 798 self.upload_success = None 800 799 upload = self.request.form.get('form.passport', None) … … 805 804 upload, self.context, self) 806 805 if self.upload_success: 807 self. files_uploaded.append('passport')806 self.context.writeLogMessage(self, 'saved: passport') 808 807 return 809 808 … … 839 838 if self.upload_success is False: # False is not None! 840 839 # Error during image upload. Ignore other values. 841 # In custom packages other file uploads might have been842 # successful.843 changed_fields = self.files_uploaded844 fields_string = ' + '.join(changed_fields)845 if fields_string:846 self.context.writeLogMessage(self, 'saved: % s' % fields_string)847 840 return 848 841 changed_fields = self.applyData(self.context, **data) … … 852 845 else: 853 846 changed_fields = [] 854 if self.upload_success:855 changed_fields += self.files_uploaded856 847 if password: 857 848 # Now we know that the form has no errors and can set password ... … … 995 986 if self.upload_success is False: # False is not None! 996 987 # Error during image upload. Ignore other values. 997 # In custom packages other file uploads might have been998 # successful.999 changed_fields = self.files_uploaded1000 fields_string = ' + '.join(changed_fields)1001 if fields_string:1002 self.context.writeLogMessage(self, 'saved: % s' % fields_string)1003 988 return 1004 989 self.applyData(self.context, **data) -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
r10030 r10095 708 708 self.assertTrue(passport1 == passport2) 709 709 return 710 711 def test_upload_image_by_manager_with_logging(self): 712 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 713 self.browser.open(self.manage_path) 714 # Create a pseudo image file and select it to be uploaded in form 715 photo_content = 'A' * 1024 * 5 # A string of 5 KB size 716 pseudo_image = StringIO(photo_content) 717 ctrl = self.browser.getControl(name='form.passport') 718 file_ctrl = ctrl.mech_control 719 file_ctrl.add_file(pseudo_image, filename='myphoto.jpg') 720 self.browser.getControl("Save").click() # submit form 721 # Even though the form could not be saved ... 722 self.assertTrue( 723 'Required input is missing' in self.browser.contents) 724 # ... the file has been successfully uploaded 725 logfile = os.path.join( 726 self.app['datacenter'].storage, 'logs', 'applicants.log') 727 logcontent = open(logfile).read() 728 self.assertTrue( 729 'zope.mgr - applicants.browser.ApplicantManageFormPage - ' 730 '%s - saved: passport' 731 % (self.applicant.applicant_id) 732 in logcontent) 710 733 711 734 def test_pay_application_fee(self):
Note: See TracChangeset for help on using the changeset viewer.