Code freeze break for Hamster



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, (_(u"Unsorted"), date, end_date))
 
     def __remove_fact(self, fact_id):
         query = """
@@ -510,16 +510,16 @@
 
     def run_fixtures(self):
         # defaults
-        work_category = {"name": _("Work"),
-                         "entries": [_("Reading news"),
-                                     _("Checking stocks"),
-                                     _("Super secret project X"),
-                                     _("World domination")]}
+        work_category = {"name": _(u"Work"),
+                         "entries": [_(u"Reading news"),
+                                     _(u"Checking stocks"),
+                                     _(u"Super secret project X"),
+                                     _(u"World domination")]}
         
-        nonwork_category = {"name": _("Day to day"),
-                            "entries": [_("Lunch"),
-                                        _("Watering flowers"),
-                                        _("Doing handstands")]}
+        nonwork_category = {"name": _(u"Day to day"),
+                            "entries": [_(u"Lunch"),
+                                        _(u"Watering flowers"),
+                                        _(u"Doing handstands")]}
         
         """upgrade DB to hamster version"""
         version = self.fetchone("SELECT version FROM version")["version"]


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