convenience function to check is an string is empty
authorIvan Frade <ivan.frade@nokia.com>
Sun, 24 Jan 2010 19:01:43 +0000 (21:01 +0200)
committerIvan Frade <ivan.frade@nokia.com>
Sun, 24 Jan 2010 19:01:43 +0000 (21:01 +0200)
src/utils.py

index ae3a4ad..daffb06 100644 (file)
@@ -8,6 +8,8 @@ def escape_html (text, max_length=40):
         text = text [0:cutpoint] + "..."
     return gobject.markup_escape_text (text)
 
+def is_empty (text):
+    return not text or len (text.strip ()) == 0
 
 # Set socket timeout
 import socket