summaryrefslogtreecommitdiff
path: root/alot/helper.py
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-10-22 12:02:30 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2011-10-22 12:02:30 +0100
commit4e6a8e97c94042fb2f74803351d32e2922f75643 (patch)
tree32c3897b295710d91bdc0fec25e1db7adfc781b5 /alot/helper.py
parentf6b020cc441591739b157776e15a64827b91e300 (diff)
move urwid_sanitize to helper.string_sanitize
Diffstat (limited to 'alot/helper.py')
-rw-r--r--alot/helper.py11
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: