Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More
lino.core.requests¶
See introduction in Using action requests and API reference in
lino.api.core.Request
.
Functions
|
|
|
Classes
|
Holds information about an individual web request and provides methods like |
|
|
|
Volatile object that wraps a given action to be run on a given model instance. |
|
|
|
|
These are the allowed keyword arguments for |
|
|
- class lino.core.requests.ValidActionResponses¶
Bases:
object
These are the allowed keyword arguments for
ar.set_response
, and the action responses supported byLino.handle_action_result()
(defined inlinolib.js
).This class is never instantiated, but used as a placeholder for these names and their documentation.
- message = None¶
A translatable message text to be shown to the user.
- alert = None¶
Set this to some translatable text to specify that the message is rather important and should alert and should be presented in a dialog box to be confirmed by the user. The text is used as the title of the alert box. If you specify True, then Lino uses a default text like “Alert” or “Warning” (depending on context).
- alert_eval_js = None¶
Javascript code to be evaluated after the confirmation of the alert dialog.
- rows = None¶
An iterable of database objects that will be serialized as a list.
- title = None¶
The dynamic title to give to the window or component which shows this response. TODO: is this still being used?
- count = None¶
The number of rows in a list response.
- data_record = None¶
Certain requests are expected to return detailed information about a single data record. That’s done in
data_record
which must itself be a dict with the following keys:id : the primary key of this record_deleted
title : the title of the detail window
data : a dict with one key for every data element
navinfo : an object with information for the navigator
disable_delete : either null (if that record may be deleted, or otherwise a message explaining why.
- record_id = None¶
When an action returns a record_id, it asks the user interface to jump to the given record.
- refresh_delayed_value = None¶
A string referencing an actor_id corresponding to a DelayedValue equivalent element or boolean True meaning all the DelayedValue(s) should be refreshed.
- xcallback = None¶
Used for dialogs asking simple yes/no/later style questions. Includes all the data the client needs in order to send the same action request again, but with some extra confirmation values.
Is a dict which includes the following values:
actor_id : The id of the actor
an : The action name of the action which was run
sr : List of selected values
- goto_url = None¶
Leave current page and go to the given URL.
- open_url = None¶
Open the given URL in a new browser window.
- warning_message = None¶
deprecated
- detail_handler_name = None¶
The name of the detail handler to be used. Application code should not need to use this. It is automatically set by
ActorRequest.goto_instance()
.
- class lino.core.requests.ActionRequest(actor=None, unused_request=None, action=None, unused_renderer=None, rqdata=None, **kw)¶
Bases:
BaseRequest
Holds information about an individual web request and provides methods like
get_user
confirm
spawn
An ActionRequest is also a
BaseRequest
and inherits its methods.An ActionRequest is instantiated from different shortcut methods:
lino.core.actions.Action.request()
- create_instance(**kw)¶
Create a row (a model instance if this is a database table) using the specified keyword arguments.
- get_status(**kw)¶
Return a dict with the “status”, i.e. a json representation of this request.
- clear_cached_status()¶
Remove any previously computed status information.
The status information of a request is cached to avoid performance issues e.g. in calendar views where a many buttons can be rendered for a same request and where the status information can be relatively heavy.
But sometimes you don’t want this. In that case you call
clear_cached_status()
.
- run(*args, **kw)¶
Runs this action request.
- class lino.core.requests.InstanceAction(action, actor, instance, owner)¶
Bases:
object
Volatile object that wraps a given action to be run on a given model instance.
- bound_action¶
The bound action that will run.
- instance¶
The database object on which the action will run.
- owner¶
- run_from_code(ar, *args, **kw)¶
Probably to be deprecated. Run this action on this instance in the given session, updating the response of the session. Returns the return value of the action.
- run_from_ui(ar, *args, **kwargs)¶
Run this action on this instance in the given session, updating the response of the session. Returns nothing.
- request_from(ses, **kwargs)¶
Create an action request on this instance action without running the action.
- run_from_session(ses, **kwargs)¶
Run this instance action in a child request of given session.
Additional arguments are forwarded to the action. Returns the response of the child request. Doesn’t modify response of parent request.
- as_button(*args, **kwargs)¶
Return a HTML chunk with a “button” which, when clicked, will execute this action on this instance. This is being used in the The Lino Polls tutorial.