`FileStore` backend assumes keys are strings
Issue #3
new
The file://
backing store assumes keys are strings and passes them
directly to urllib.quote_plus
. The following code demoes the
issue::
#! /usr/bin/env python
#
from tempfile import mkdtemp
import shove
# make temp dir
tmpdir = mkdtemp(prefix='issue3.', suffix='.tmp.d')
store_uri = 'file://' + tmpdir
data = shove.Shove(store=store_uri)
for n in range(10):
data[n] = str(n*n)
Indeed::
$ ./shove_issue_3.py
Traceback (most recent call last):
File "./gc3libs/shove_issue_3.py", line 16, in <module>
data[n] = str(n*n)
File ".../shove/core.py", line 44, in __setitem__
self.sync()
File ".../shove/core.py", line 74, in sync
self._store.update(self._buffer)
File ".../lib/python2.7/_abcoll.py", line 566, in update
self[key] = other[key]
File ".../shove/base.py", line 120, in __setitem__
with open(self._key_to_file(key), 'wb') as item:
File ".../shove/base.py", line 154, in _key_to_file
return join(self._dir, quote_plus(key))
File "/usr/lib/python2.7/urllib.py", line 1303, in quote_plus
if ' ' in s:
TypeError: argument of type 'int' is not iterable