mbr / simplekv

A simple key-value store for binary data.
http://simplekv.readthedocs.io
MIT License
152 stars 50 forks source link

_put_file unimplemented even though _put calls it #82

Closed cjy008 closed 5 years ago

cjy008 commented 5 years ago
    def _put(self, key, data):
        """Implementation for :meth:`~simplekv.KeyValueStore.put`. The default
        implementation will create a :class:`io.BytesIO`-buffer and then call
        :meth:`~simplekv.KeyValueStore._put_file`.

        :param key: Key under which data should be stored
        :param data: Data to be stored
        """
        return self._put_file(key, BytesIO(data))

    def _put_file(self, key, file):
        """Store data from file-like object in key. Either this method or
        :meth:`~simplekv.KeyValueStore._put_filename` will be called by
        :meth:`~simplekv.KeyValueStore.put_file`. Note that this method does
        not accept strings.

        The default implementation will simply raise a
        :py:exc:`~exceptions.NotImplementedError`.

        :param key: Key under which data should be stored
        :param file: File-like object to store data from
        """
        raise NotImplementedError

JWT requires a simplekv KeyValueStore if you're using the blacklist feature. However, when it tries to use the simplekv features, it calls _put(something) which calls _put_file(something) and that raises a Not Implemented Error.

        self._flask_app.config['JWT_BLACKLIST_ENABLED'] = True
        self._flask_app.config['JWT_BLACKLIST_STORE'] = simplekv.KeyValueStore()
criemen commented 5 years ago

Hi,

sorry for the late answer. simplekv.KeyValueStore is an abstract base class for different store types. Depending on what persistence guarantees you need, you should probably look into using a FileSystemStore. Have a look at its documentation over here: https://simplekv.readthedocs.io/en/latest/filesystem.html#simplekv.fs.FilesystemStore. I'm closing this as this is not a bug, but please feel free to ask further questions here in case you need more help.