[pitivi: 3/94] Change ElementTreeFormatter to allow storing empty string values. Fixes bug 603209.
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi: 3/94] Change ElementTreeFormatter to allow storing empty string values. Fixes bug 603209.
- Date: Sun, 11 Sep 2011 16:12:42 +0000 (UTC)
commit b6954312ba8246e32296adac67d14fcf897034bb
Author: Alex BÄluÈ <alexandru balut gmail com>
Date: Thu Jul 7 11:18:42 2011 +0200
Change ElementTreeFormatter to allow storing empty string values.
Fixes bug 603209.
pitivi/formatters/etree.py | 5 +++--
tests/test_etree_formatter.py | 3 +++
2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/formatters/etree.py b/pitivi/formatters/etree.py
index 402ad1b..f20530b 100644
--- a/pitivi/formatters/etree.py
+++ b/pitivi/formatters/etree.py
@@ -106,6 +106,8 @@ class ElementTreeFormatter(Formatter):
yield name, value
def _parsePropertyValue(self, value):
+ if value == "":
+ return value
# We treat the GEnum values differently because they are actually ints.
if "(GEnum)" in value:
return int(value.split("(GEnum)")[1])
@@ -293,8 +295,7 @@ class ElementTreeFormatter(Formatter):
"""Get the specified Element as a deserialized dict."""
values_dict = {}
for name, value_string in element.attrib.iteritems():
- if value_string:
- values_dict[name] = self._parsePropertyValue(value_string)
+ values_dict[name] = self._parsePropertyValue(value_string)
return values_dict
def _saveProjectSettings(self, settings):
diff --git a/tests/test_etree_formatter.py b/tests/test_etree_formatter.py
index 68a6fb0..039c5c9 100644
--- a/tests/test_etree_formatter.py
+++ b/tests/test_etree_formatter.py
@@ -72,6 +72,9 @@ class TestSerialization(TestCase):
for key, value in values_dict.iteritems():
self.assertEqual(value, deserialized_values_dict[key])
+ def testEmptyValuesDeserialization(self):
+ self.assertEqual("", self.formatter._parsePropertyValue(""))
+
class TestFormatterSave(TestCase):
def setUp(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]