[hamster-applet] be more careful on sanitizing - strip out only hashes that are preceded by a whitespace, don't strip



commit fd0a3976d96c0c195e2960ec6ba483210fd7fb3c
Author: Toms Bauģis <toms baugis gmail com>
Date:   Sat May 21 16:53:07 2011 +0300

    be more careful on sanitizing - strip out only hashes that are preceded by a whitespace, don't strip out hashes out of categories. should fix Bug 638544

 src/hamster/lib/stuff.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/hamster/lib/stuff.py b/src/hamster/lib/stuff.py
index 8887a4e..842158b 100644
--- a/src/hamster/lib/stuff.py
+++ b/src/hamster/lib/stuff.py
@@ -294,8 +294,8 @@ class Fact(object):
             activity, self.description = activity.split(",", 1)
             self.description = self.description.strip()
 
-            if "#" in self.description:
-                self.description, self.tags = self.description.split("#", 1)
+            if " #" in self.description:
+                self.description, self.tags = self.description.split(" #", 1)
                 self.tags = [tag.strip(", ") for tag in self.tags.split("#") if tag.strip(", ")]
 
         if activity.find("@") > 0:
@@ -315,8 +315,8 @@ class Fact(object):
             tags = [tag.strip() for tag in tags.split(",") if tag.strip()]
 
         # override implicit with explicit
-        self.category = category.replace("#", "").replace(",", "") or self.category or None
-        self.description = (description or "").replace("#", "") or self.description or None
+        self.category = category.replace(",", "") or self.category or None
+        self.description = (description or "").replace(" #", " ") or self.description or None
         self.tags =  tags or self.tags or []
         self.start_time = start_time or self.start_time or None
         self.end_time = end_time or self.end_time or None



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]