diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2011-10-22 12:02:30 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-10-22 12:02:30 +0100 |
commit | 4e6a8e97c94042fb2f74803351d32e2922f75643 (patch) | |
tree | 32c3897b295710d91bdc0fec25e1db7adfc781b5 /alot/helper.py | |
parent | f6b020cc441591739b157776e15a64827b91e300 (diff) |
move urwid_sanitize to helper.string_sanitize
Diffstat (limited to 'alot/helper.py')
-rw-r--r-- | alot/helper.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/alot/helper.py b/alot/helper.py index 2706ca63..06952102 100644 --- a/alot/helper.py +++ b/alot/helper.py @@ -31,6 +31,17 @@ from email.mime.image import MIMEImage from email.mime.text import MIMEText import urwid +from settings import config + + +def string_sanitize(string): + """strips, and replaces non-printable characters""" + tab_width = config.getint('general', 'tabwidth') + string = string.strip() + string = string.replace('\t', ' ' * tab_width) + string = string.replace('\r', '') + return string + def shorten(string, maxlen): if maxlen > 1 and len(string) > maxlen: |