The below are abstract interfaces expected to be fulfilled by various Deform implementations.
deform.FileUploadWidgetrequires as its first argument a
tmpstore. Such a tmpstore will implement this interface: an object implementing the FileUploadTempStore interface should implement the methods attached to this description.
Effectively, this interface is a subset of the
dictinterface plus an additional method named
preview_url. In fact, the simplest possible implementation of this interface is:
class MemoryTmpStore(dict): def preview_url(self, name): return None
deform.FileUploadWidgetdoes not remove data from the tempstore implementation it uses (it doesn’t have enough information to be able to do so), and it is job of the tempstore implementation itself to expire items which haven’t been accessed in a while.
Therefore, the above
MemoryTmpStoreimplementation is generally unsuitable for production, as the data put into it is not automatically evicted over time and file upload data provided by untrusted users is usually unsuitable for storage in RAM. It’s more likely that an implementation in your application will center around a sessioning library (such as Beaker) that does data eviction and which stores file upload data in persistent storage.
Same as dict.get.
Get a value.
Set a value.
This should return True if we have a value for the name supplied, False otherwise.
Return the preview URL for the item previously placed into the tmpstore named
Noneif there is no preview for
nameavailable (or if this tmpstore does not support previewable items). This item should typically return a URL to a thumbnail image.