Changeset 16818 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 21 Feb 2022, 06:21:10 (3 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py
r16538 r16818 1510 1510 invalid_line = check_csv_charset(filecontent.splitlines()) 1511 1511 if invalid_line: 1512 if invalid_line == -1: 1513 self.flash(_( 1514 "The data in your file contain trailing whitespaces. " 1515 "Please replace."), type='danger') 1516 else: 1517 self.flash(_( 1518 "Your file contains forbidden characters or " 1519 "has invalid CSV format. " 1520 "First problematic line detected: line %s. " 1521 "Please replace." % invalid_line), type='danger') 1512 self.flash(_( 1513 "Your file contains forbidden characters or " 1514 "has invalid CSV format. " 1515 "First problematic line detected: line %s. " 1516 "Please replace." % invalid_line), type='danger') 1522 1517 logger.info('%s - invalid file uploaded: %s' % 1523 1518 (ob_class, target)) -
main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_browser.py
r16187 r16818 204 204 return 205 205 206 def test_forbidden_file_upload_2(self):206 def deprecated_test_forbidden_file_upload_2(self): 207 207 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 208 208 self.browser.open(self.datacenter_path) -
main/waeup.kofa/trunk/src/waeup/kofa/utils/converters.py
r12415 r16818 280 280 new_data = dict() 281 281 for key, val in data_dict.items(): 282 val = val.strip() 282 283 field = form_fields.get(key, None) 283 284 if field is not None: -
main/waeup.kofa/trunk/src/waeup/kofa/utils/helpers.py
r15748 r16818 770 770 Returns line num of first illegal char or ``None``. Line nums 771 771 start counting with 1 (not zero). Returns -1 if data contain 772 trailing whitespaces .772 trailing whitespaces (deactivated). 773 773 """ 774 774 linenum = 1 … … 777 777 for row in reader: 778 778 linenum += 1 779 for value in row.values():780 if value.endswith(' '):781 return -1779 #for value in row.values(): 780 # if value.endswith(' '): 781 # return -1 782 782 except UnicodeDecodeError: 783 783 return linenum -
main/waeup.kofa/trunk/src/waeup/kofa/utils/tests/test_converters.py
r14008 r16818 200 200 contact = Contact() 201 201 contact.age = 33 202 input_data = dict(name=' Rudi', age='99')202 input_data = dict(name=' Rudi ', age=' 99 ') 203 203 converter = IObjectConverter(IContact) # a converter to IContact 204 204 err, inv_err, data = converter.fromStringDict( … … 283 283 def test_textline(self): 284 284 contact = Contact() 285 input_data = dict(name=' Rudi')285 input_data = dict(name=' Rudi ') 286 286 converter = IObjectConverter(IContact) # a converter to IContact 287 287 err, inv_err, data = converter.fromStringDict( … … 357 357 # pass string ``contact`` instead of a real object 358 358 err, inv_err, data = converter.fromStringDict( 359 dict(name=' Gabi', age='23'), 'contact')359 dict(name=' Gabi ', age='23 '), 'contact') 360 360 self.assertEqual(data['age'], 23) 361 361 self.assertEqual(data['name'], u'Gabi') -
main/waeup.kofa/trunk/src/waeup/kofa/utils/tests/test_helpers.py
r14948 r16818 545 545 "FAC3,Fäcülty 3,school\n" 546 546 ).splitlines() 547 self.assertEqual(helpers.check_csv_charset(csv), -1)547 self.assertEqual(helpers.check_csv_charset(csv), None) 548 548 549 549 class MemInfoTestCase(unittest.TestCase):
Note: See TracChangeset for help on using the changeset viewer.