From b3a5dadb60c362b44b865122fda10ca23a7a244d Mon Sep 17 00:00:00 2001 From: Sascha Silbe Date: Sun, 22 Apr 2012 16:51:03 +0200 Subject: [PATCH] Store metadata as pure Python data types in git Pure Python data types can be safely parsed using ast.literal_eval(), removing the need for unsafe evaluation. Previously, numeric data was stored as dbus types (e.g. "dbus.Int32(0, variant_level=1)"). --- gdatastore/datastore.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gdatastore/datastore.py b/gdatastore/datastore.py index ae9a657..d74ebc3 100644 --- a/gdatastore/datastore.py +++ b/gdatastore/datastore.py @@ -656,7 +656,12 @@ def to_native(value): return unicode(value) elif isinstance(value, str): return str(value) - return value + elif isinstance(value, int): + return int(value) + elif isinstance(value, float): + return float(value) + else: + raise TypeError('Unknown type: %s' % (type(value), )) def _format_ref(tree_id, version_id): -- 1.7.9.5