[gnome-tweak-tool/gnome-3-2] Tidy schema reading code
- From: John Stowers <jstowers src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool/gnome-3-2] Tidy schema reading code
- Date: Wed, 9 Nov 2011 22:37:45 +0000 (UTC)
commit 3750fcc49f8256a2dea18505878ef0c341de87e1
Author: John Stowers <john stowers gmail com>
Date: Thu Nov 10 11:37:10 2011 +1300
Tidy schema reading code
NEWS | 3 +++
gtweak/gsettings.py | 8 ++++----
2 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index d56837e..1599417 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+3.2.2
+ * Dont die on malformed schemas
+
3.2.1
* Translation updates
* Ellipsize long strings - should fix window size issues
diff --git a/gtweak/gsettings.py b/gtweak/gsettings.py
index ea21927..ca7020f 100644
--- a/gtweak/gsettings.py
+++ b/gtweak/gsettings.py
@@ -42,18 +42,18 @@ class _GSettingsSchema:
if schema_name == schema.getAttribute("id"):
for key in schema.getElementsByTagName("key"):
#summary is compulsory, description is optional
- summary = key.getElementsByTagName("summary")
+ #... in theory, but we should not barf on bad schemas ever
try:
- summary_text = summary[0].childNodes[0].data
+ summary = key.getElementsByTagName("summary")[0].childNodes[0].data
except:
- summary_text = ""
+ summary = ""
logging.warning("Schema %s missing summary text: %s" % (schema_path, key.toxml()))
try:
description = key.getElementsByTagName("description")[0].childNodes[0].data
except:
description = ""
self._schema[key.getAttribute("name")] = {
- "summary" : summary_text,
+ "summary" : summary,
"description" : description
}
except:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]