Re: Code freeze break for Hamster



Horribly sorry, the patch attached was not the right one.
Attaching the right one with this letter.

Also forgot to mention that this does not involve string breaks or anything.

Toms

On Thu, Mar 12, 2009 at 6:33 PM, Toms <toms baugis gmail com> wrote:
> We have stumbled upon a nasty bug regarding sqlite, python 2.6 and unicode.
> It's a crasher for users that did not use hamster previously - we had
> some non-utf8-encoded strings in fixtures.
> Patch being quite trivial is attached to this email.
>
> Please allow me to commit it.
>
>
> I'd like to thank Miroslav Binas for fiding the bug and help in triage.
>
> Toms
>
Index: hamster/db.py
===================================================================
--- hamster/db.py	(revision 829)
+++ hamster/db.py	(working copy)
@@ -340,7 +340,7 @@
         """
         end_date = end_date or date        
 
-        return self.fetchall(query, (_("Unsorted"), date, end_date))
+        return self.fetchall(query, (unicode(_("Unsorted")), date, end_date))
 
     def __remove_fact(self, fact_id):
         query = """
@@ -702,13 +702,13 @@
         category_count = self.fetchone("select count(*) from categories")[0]
         
         if category_count == 0:
-            work_cat_id = self.__add_category(_(work_category["name"]))
+            work_cat_id = self.__add_category(unicode(work_category["name"]))
             for entry in work_category["entries"]:
-                self.__add_activity(_(entry), work_cat_id)
+                self.__add_activity(unicode(entry), work_cat_id)
         
-            nonwork_cat_id = self.__add_category(_(nonwork_category["name"]))
+            nonwork_cat_id = self.__add_category(unicode(nonwork_category["name"]))
             for entry in nonwork_category["entries"]:
-                self.__add_activity(_(entry), nonwork_cat_id)
+                self.__add_activity(unicode(entry), nonwork_cat_id)
         
         
         


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