Commit 09f1dcee authored by Gilles Guitton's avatar Gilles Guitton

- abstractfeature.py :

-- make self._fields default to an empty OrderedDict rather than an empty dict.
-- allow fields argument of __init__ to be an OrderedDict.
parent 2e3cb8c2
......@@ -55,8 +55,9 @@ class AbstractFeature(object):
"""
"""
object.__init__(self)
if fields is not None:
assert (type(fields) is dict), "fields must be a dictionary"
if fields is not None and not isinstance(fields, dict):
raise Exception('fields must be a dictionary (use an OrderedDict '
'if you want to write fields in a specific order).')
self._datastorage = None
# geolocation fields (time,lat,lon)
self._geolocation_fields = {'time': None,
......@@ -110,7 +111,7 @@ class AbstractFeature(object):
self.metadata = {}
self._fields = fields
if fields is None:
self._fields = {}
self._fields = collections.OrderedDict()
return
def __str__(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment