gws.base.storage.core¶
Storage object.
Source code: gws.base.storage.core
Module Contents¶
- class gws.base.storage.core.Config(*args, **kwargs)¶
Bases:
gws.ConfigWithAccessStorage for entries saved by users.
- class gws.base.storage.core.Object¶
Bases:
gws.NodeStorage object, gives users access to entries of one category in a storage provider.
- storageProvider: gws.StorageProvider¶
Storage provider.
- configure()¶
Configuration hook.
Called when the node is initialized. Raising an exception here aborts the creation of the node.
- configure_provider()¶
Find the storage provider by
providerUid, or use the first provider.- Returns:
True.- Raises:
gws.Error – If no provider is found.
- get_state_for(user)¶
Return the storage state for a user.
- Parameters:
user – The user.
- Returns:
The entry names, if the user can read them, and the user’s permissions.
- handle_request(req: gws.WebRequester, p: Request) Response¶
Handle a storage request from the client.
Writing an existing entry requires the
writepermission, writing a new one requirescreate. Entry data is stored as JSON.- Parameters:
req – Web requester.
p – Storage request.
- Returns:
The entry data for a read request, and the new storage state.
- Raises:
gws.ForbiddenError – If the user lacks the permission or the entry name or data is missing.
- props(user)¶
Generate a
Propsstruct for this object.Do not call this method directly, use
gws.props_ofinstead, which also checks permissions.- Parameters:
user – The user for which the props should be generated.
- Returns:
A
Propsobject or a dict. Nested objects are converted to props as well.
- class gws.base.storage.core.Request(*args, **kwargs)¶
Bases:
gws.RequestStorage request.
- entryData: dict | None¶
Entry data to write.
- class gws.base.storage.core.Response(*args, **kwargs)¶
Bases:
gws.ResponseStorage response.
- data: dict | None¶
Entry data for a read request.