Changeset 10676 for main/waeup.kofa/trunk/src/waeup/kofa/browser
- Timestamp:
- 31 Oct 2013, 17:51:25 (11 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/browser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py
r10650 r10676 69 69 from waeup.kofa.authentication import LocalRoleSetEvent 70 70 from waeup.kofa.widgets.htmlwidget import HTMLDisplayWidget 71 from waeup.kofa.utils.helpers import get_user_account 71 from waeup.kofa.utils.helpers import get_user_account, check_csv_charset 72 72 from waeup.kofa.mandates.mandate import PasswordMandate 73 73 from waeup.kofa.datacenter import DataCenterFile … … 1065 1065 1066 1066 # Forbid certain characters in import files. 1067 for element in filecontent: 1068 try: 1069 if ord(element) in FORBIDDEN_CHARACTERS: 1070 self.flash(_( 1071 "Your file contains forbidden characters. " 1072 "Please replace.")) 1073 logger.info('%s - invalid file uploaded: %s' % 1074 (ob_class, target)) 1075 return 1076 except TypeError: 1077 self.flash(_( 1078 "Your file contains forbidden characters. " 1079 "Please replace.")) 1080 logger.info('%s - invalid file uploaded: %s' % 1081 (ob_class, target)) 1082 return 1067 invalid_line = check_csv_charset(filecontent.splitlines()) 1068 if invalid_line: 1069 self.flash(_( 1070 "Your file contains forbidden characters or " 1071 "has invalid CSV format. " 1072 "First problematic line detected: line %s. " 1073 "Please replace." % invalid_line)) 1074 logger.info('%s - invalid file uploaded: %s' % 1075 (ob_class, target)) 1076 return 1083 1077 1084 1078 open(target, 'wb').write(filecontent) -
main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_browser.py
r10634 r10676 157 157 self.browser.getControl('Upload').click() 158 158 self.assertTrue( 159 'Your file contains forbidden characters . Please replace.'159 'Your file contains forbidden characters or' 160 160 in self.browser.contents) 161 161 logfile = os.path.join(
Note: See TracChangeset for help on using the changeset viewer.