diff options
author | Sascha Silbe <sascha-pgp@silbe.org> | 2012-04-22 14:51:03 (GMT) |
---|---|---|
committer | Sascha Silbe <sascha-pgp@silbe.org> | 2012-04-22 14:51:03 (GMT) |
commit | b3a5dadb60c362b44b865122fda10ca23a7a244d (patch) | |
tree | 94db99d4e9c3f039ff7d164bf8fcf663956aeb74 | |
parent | d6057b26ab7c6f8412457ca7be97d4e146ed9cad (diff) |
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)").
-rw-r--r-- | gdatastore/datastore.py | 7 |
1 files changed, 6 insertions, 1 deletions
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): |