Other decorators

class simplekv.decorator.PrefixDecorator(prefix, store)

Prefixes any key with a string before passing it on the decorated store. Automatically strips the prefix upon key retrieval.

Parameters:
  • store – The store to pass keys on to.
  • prefix – Prefix to add.
class simplekv.decorator.URLEncodeKeysDecorator(store)

URL-encodes keys before passing them on to the underlying store.

class simplekv.decorator.ReadOnlyDecorator(store)

A read-only view of an underlying simplekv store

Provides only access to the following methods/attributes of the underlying store: get, iter_keys, keys, open, get_file. It also forwards __contains__. Accessing any other method will raise AttributeError.

Note that the original store for r/w can still be accessed, so using this class as a wrapper only provides protection against bugs and other kinds of unintentional writes; it is not meant to be a real security measure.