CLEANUP
takes a regex
argument, which defaults to '[^\x09\x0a\x0d\x20-\x7e]'
. It first strips leading and trailing whitespace and then removes any characters that match the regex. Since you only need to remove the whitespace, you can supply an empty regex:
Field('myfield', requires=CLEANUP(''))
You could also achieve the same with a custom validator:
Field('myfield', requires=lambda v: (str(v).strip(), None))