def preparer(self, appstruct): return strip_whitespace(appstruct)
def test_does_remove_middle_spaces(self): self.assertEqual(strip_whitespace('a b c'), 'a b c')
def test_idempotent_for_null_values(self): self.assertEqual(strip_whitespace(colander.null), colander.null)
def test_removes_all_kinds_of_spaces(self): value = " \t teaser \n \r" self.assertEqual(strip_whitespace(value), 'teaser')
def preparer(self, appstruct): if appstruct: # Strip then truncate the title to TITLE_MAX_LENGTH appstruct = strip_whitespace(appstruct)[:TITLE_MAX_LENGTH] return appstruct