Changeset 6598
- Timestamp:
- 12 Aug 2011, 15:23:23 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
r6595 r6598 54 54 ThumbnailWidget, EncodingImageFileWidget, 55 55 ) 56 from waeup.sirp.image.image import createWAeUPImageFile 56 57 from waeup.sirp.interfaces import IWAeUPObject, ILocalRolesAssignable 57 58 from waeup.sirp.permissions import get_users_with_local_roles … … 708 709 super(EditApplicantFull, self).update() 709 710 self.wf_info = IWorkflowInfo(self.context) 711 upload = self.request.form.get('form.passport', None) 712 if upload: 713 # We got a fresh upload 714 image = createWAeUPImageFile(upload.filename, upload) 715 # This would normally be totally illegal. We set context 716 # data without the complete form data being 717 # verified. Normally data is set in methods like `save` 718 # only, which is only called when all form data is correct 719 # (and if not, the context is not touched). With images 720 # and their uploads the problem then is, that the uploaded 721 # image won't be shown in a partially erranous form 722 # because the new uploaded image is still not part of the 723 # context obeject and the image widget cannot work around 724 # that (it has no access to the new data). For this reason 725 # we set the image here and not in 'save()' or other 726 # methods. 727 self.context.passport = image 728 upload.seek(0) 729 self.passport_changed = True 710 730 return 711 731 … … 769 789 def update(self): 770 790 if self.context.locked: 771 #import pdb; pdb.set_trace()772 791 self.emitLockMessage() 773 792 return 774 793 datepicker.need() # Enable jQuery datepicker in date fields. 794 upload = self.request.form.get('form.passport', None) 795 if upload: 796 # We got a fresh upload 797 image = createWAeUPImageFile(upload.filename, upload) 798 # This would normally be totally illegal. We set context 799 # data without the complete form data being 800 # verified. Normally data is set in methods like `save` 801 # only, which is only called when all form data is correct 802 # (and if not, the context is not touched). With images 803 # and their uploads the problem then is, that the uploaded 804 # image won't be shown in a partially erranous form 805 # because the new uploaded image is still not part of the 806 # context obeject and the image widget cannot work around 807 # that (it has no access to the new data). For this reason 808 # we set the image here and not in 'save()' or other 809 # methods. 810 self.context.passport = image 811 upload.seek(0) 812 self.passport_changed = True 775 813 super(EditApplicantStudent, self).update() 776 814 return
Note: See TracChangeset for help on using the changeset viewer.