Request¶
Todo
Docstrings (module)
Models¶
-
class
indico.modules.events.requests.models.requests.
Request
(**kwargs)¶ Bases:
sqlalchemy.orm.decl_api.Model
Event-related requests, e.g. for a webcast.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
can_be_modified
¶ Determine if the request can be modified or if a new one must be sent.
-
comment
¶ an optional comment for an accepted/rejected request
-
created_by_id
¶ ID of the user creating the request
-
created_by_user
¶ The user who created the request
-
created_dt
¶ the date/time the request was created
-
data
¶ plugin-specific data of the request
-
definition
¶
-
event
¶ The Event this agreement is associated with
-
event_id
¶ ID of the event
-
classmethod
find_latest_for_event
(event, type_=None)¶ Return the latest requests for a given event.
Parameters: - event – the event to find the requests for
- type – the request type to retrieve, or None to get all
Returns: a dict mapping request types to a
Request
or if type_ was specified, a singleRequest
or None
-
id
¶ request ID
-
locator
¶
-
processed_by_id
¶ ID of the user processing the request
-
processed_by_user
¶ The user who processed the request
-
processed_dt
¶ the date/time the request was accepted/rejected
-
state
¶ the requests’s date, a
RequestState
value
-
type
¶ the request type name
-
Utilities¶
-
indico.modules.events.requests.util.
get_request_definitions
()¶ Return a dict of request definitions.
-
indico.modules.events.requests.util.
is_request_manager
(user)¶ Check if the user manages any request types.
-
class
indico.modules.events.requests.base.
RequestDefinitionBase
¶ Bases:
object
A service request which can be sent by event managers.
-
classmethod
accept
(req, data, user)¶ Accept the request.
To ensure that additional data is saved, this method should call :method:`manager_save`.
Parameters: - req – the
Request
of the request - data – the form data from the management form
- user – the user processing the request
- req – the
-
classmethod
can_be_managed
(user)¶ Check whether the user is allowed to manage this request type.
Parameters: user – a User
-
classmethod
create_form
(event, existing_request=None)¶ Create the request form.
Parameters: - event – the event the request is for
- existing_request – the
Request
if there’s an existing request of this type
Returns: an instance of an
IndicoForm
subclass
-
classmethod
create_manager_form
(req)¶ Create the request management form.
Parameters: req – the Request
of the requestReturns: an instance of an IndicoForm
subclass
-
form
= None¶ the
IndicoForm
to use for the request form
-
form_defaults
= {}¶ default values to use if there’s no existing request
-
classmethod
get_manager_notification_emails
()¶ Return the email addresses of users who manage requests of this type.
The email addresses are used only for notifications. It usually makes sense to return the email addresses of the users who pass the :method:`can_be_managed` check.
Returns: set of email addresses
-
classmethod
get_notification_reply_email
()¶ Return the Reply-To e-mail address for notifications.
-
classmethod
get_notification_template
(name, **context)¶ Get the template module for a notification email.
Parameters: - name – the template name
- context – data passed to the template
-
manager_form
¶ the
IndicoForm
to use for the request manager formalias of
RequestManagerForm
-
classmethod
manager_save
(req, data)¶ Save management-specific data.
This method is called when the management form is submitted without accepting/rejecting the request (which is guaranteed to be already accepted or rejected).
Parameters: - req – the
Request
of the request - data – the form data from the management form
- req – the
-
name
= None¶ the unique internal name of the request type
-
plugin
= None¶ the plugin containing this request definition - assigned automatically
-
classmethod
reject
(req, data, user)¶ Reject the request.
To ensure that additional data is saved, this method should call :method:`manager_save`.
Parameters: - req – the
Request
of the request - data – the form data from the management form
- user – the user processing the request
- req – the
-
classmethod
render_form
(event, **kwargs)¶ Render the request form.
Parameters: - event – the event the request is for
- kwargs – arguments passed to the template
-
classmethod
send
(req, data)¶ Send a new/modified request.
Parameters: - req – the
Request
of the request - data – the form data from the request form
- req – the
-
title
= None¶ the title of the request type as shown to users
-
classmethod
withdraw
(req, notify_event_managers=True)¶ Withdraw the request.
Parameters: - req – the
Request
of the request - notify_event_managers – if event managers should be notified
- req – the
-
classmethod