+# Escape characters which have meaning to SQL's regex comparison operator ('~')
+# (woefully incomplete)
+
+def regex_safe (s):
+ s = string.replace(s, '+', '\\\\+');
+ return s
+
+######################################################################################
+
+def size_type (c):
+ t = " b";
+ if c > 10000:
+ c = c / 1000;
+ t = " Kb";
+ if c > 10000:
+ c = c / 1000;
+ t = " Mb";
+ return ("%d%s" % (c, t))