* src/Utils.py: handle missing/invalid encoding
* src/DisplayModels/_BaseModel.py: handle None vs. 0 svn: r7997
This commit is contained in:
parent
89428da95e
commit
b5aa6154b3
@ -1,4 +1,6 @@
|
|||||||
2007-01-27 Don Allingham <don@gramps-project.org>
|
2007-01-27 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/Utils.py: handle missing/invalid encoding
|
||||||
|
* src/DisplayModels/_BaseModel.py: handle None vs. 0
|
||||||
* src/Editors/_EditPerson.py (EditPerson._image_button_press): check
|
* src/Editors/_EditPerson.py (EditPerson._image_button_press): check
|
||||||
for window already being open (#882)
|
for window already being open (#882)
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
|||||||
GNOME_DOC_INIT
|
GNOME_DOC_INIT
|
||||||
|
|
||||||
dnl RELEASE=0.SVN$(svnversion -n .)
|
dnl RELEASE=0.SVN$(svnversion -n .)
|
||||||
RELEASE=0rc1
|
RELEASE=1
|
||||||
|
|
||||||
VERSIONSTRING=$VERSION
|
VERSIONSTRING=$VERSION
|
||||||
if test x"$RELEASE" != "x"
|
if test x"$RELEASE" != "x"
|
||||||
|
@ -162,7 +162,7 @@ class BaseModel(gtk.GenericTreeModel):
|
|||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
index = self.indexlist.get(handle)
|
index = self.indexlist.get(handle)
|
||||||
if index:
|
if index != None:
|
||||||
node = self.get_iter(index)
|
node = self.get_iter(index)
|
||||||
self.row_inserted(index, node)
|
self.row_inserted(index, node)
|
||||||
|
|
||||||
|
@ -298,7 +298,8 @@ class PersonNavView(BookMarkView):
|
|||||||
|
|
||||||
self.other_action = gtk.ActionGroup(self.title + '/PersonOther')
|
self.other_action = gtk.ActionGroup(self.title + '/PersonOther')
|
||||||
self.other_action.add_actions([
|
self.other_action.add_actions([
|
||||||
('SetActive', gtk.STOCK_HOME, _("Set _Home Person"), None, None, self.set_default_person),
|
('SetActive', gtk.STOCK_HOME, _("Set _Home Person"), None,
|
||||||
|
None, self.set_default_person),
|
||||||
])
|
])
|
||||||
|
|
||||||
self.add_action_group(self.back_action)
|
self.add_action_group(self.back_action)
|
||||||
|
20
src/Utils.py
20
src/Utils.py
@ -110,9 +110,10 @@ def fix_encoding(value):
|
|||||||
try:
|
try:
|
||||||
return unicode(value)
|
return unicode(value)
|
||||||
except:
|
except:
|
||||||
codeset = locale.getpreferredencoding()
|
try:
|
||||||
if codeset == 'UTF-8':
|
codeset = locale.getpreferredencoding()
|
||||||
codeset = 'latin1'
|
except:
|
||||||
|
codeset = "UTF-8"
|
||||||
return unicode(value,codeset)
|
return unicode(value,codeset)
|
||||||
else:
|
else:
|
||||||
return value
|
return value
|
||||||
@ -291,9 +292,16 @@ def find_file( filename):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
# Build list of alternate encodings
|
# Build list of alternate encodings
|
||||||
encodings = [sys.getfilesystemencoding(), locale.getpreferredencoding(),
|
encodings = set()
|
||||||
'UTF-8', 'ISO-8859-1']
|
|
||||||
encodings = list(set(encodings))
|
for enc in [sys.getfilesystemencoding, locale.getpreferredencoding]:
|
||||||
|
try:
|
||||||
|
encodings.add(enc)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
encodings.add('UTF-8')
|
||||||
|
encodings.add('ISO-8859-1')
|
||||||
|
|
||||||
for enc in encodings:
|
for enc in encodings:
|
||||||
try:
|
try:
|
||||||
fname = filename.encode(enc)
|
fname = filename.encode(enc)
|
||||||
|
Loading…
Reference in New Issue
Block a user