From fe62a1bf0db214c5f302963aa5593502dfeae5f8 Mon Sep 17 00:00:00 2001 From: Manuel QuiƱones Date: Wed, 28 Mar 2012 15:29:53 +0000 Subject: Store empty strings instead of None in the places sqlite database. The SQL model sets "text" as the fields type for uri and title. However, sqlite uses a dynamic type sistem [1] and our Place class was initializing those attributes with None. As a consequence, when the user types something in the toolbar entry, and a search is made to show a drop-down list for autocomplete, the drop-down list is being filled with None, but is defined as Gtk.ListStore(str, str). This is provoking a GTK+ error,that crashes the activity in the XO, as bug In order to keep backwards compatibility, if the database returns None for does fields, they are translated to empty strings in _place_from_row() method of place.SqliteStore . [1] http://sqlite.org/datatype3.html Signed-off-by: Manuel QuiƱones Signed-off-by: Simon Schampijer --- diff --git a/places.py b/places.py index 8b98c79..5001b43 100644 --- a/places.py +++ b/places.py @@ -24,9 +24,9 @@ _store = None class Place(object): - def __init__(self, uri=None): + def __init__(self, uri=''): self.uri = uri - self.title = None + self.title = '' self.bookmark = False self.gecko_flags = 0 self.visits = 0 @@ -121,6 +121,14 @@ class SqliteStore(object): def _place_from_row(self, row): place = Place() + # Return uri and title as empty strings instead of None. + # Previous versions of Browse were allowing to store None for + # those fields in the places database. See ticket #3400 . + if row[0] == None: + row = tuple([''] + list(row[1:])) + if row[1] == None: + row = tuple([row[0], ''] + list(row[2:])) + place.uri, place.title, place.bookmark, place.gecko_flags, \ place.visits, place.last_visit = row -- cgit v0.9.1