aboutsummaryrefslogtreecommitdiff
path: root/wqflask/maintenance/dataset/utilities.py
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/maintenance/dataset/utilities.py')
-rw-r--r--wqflask/maintenance/dataset/utilities.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/wqflask/maintenance/dataset/utilities.py b/wqflask/maintenance/dataset/utilities.py
index 453ee707..5ffa9047 100644
--- a/wqflask/maintenance/dataset/utilities.py
+++ b/wqflask/maintenance/dataset/utilities.py
@@ -1,4 +1,5 @@
import MySQLdb
+import re
def get_cursor():
host = 'localhost'
@@ -7,4 +8,12 @@ def get_cursor():
db = 'db_webqtl'
con = MySQLdb.Connect(db=db, host=host, user=user, passwd=passwd)
cursor = con.cursor()
- return cursor \ No newline at end of file
+ return cursor
+
+def clearspaces(s):
+ if s:
+ s = re.sub('\s+', ' ', s)
+ s = s.strip()
+ return s
+ else:
+ return None