Request¶
Todo
Docstrings (module)
Models¶
-
class
indico.modules.events.requests.models.requests.
Request
(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.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
¶ Determines 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 payment
-
definition
¶
-
event
¶ The Event this agreement is associated with
-
event_id
¶ ID of the event
-
classmethod
find_latest_for_event
(event, type_=None)¶ Returns 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
()¶ Returns a dict of request definitions
-
indico.modules.events.requests.util.
is_request_manager
(user)¶ Checks if the user manages any request types
-
class
indico.modules.events.requests.base.
RequestDefinitionBase
¶ Bases:
object
Defines a service request which can be sent by event managers.
-
classmethod
accept
(req, data, user)¶ Accepts 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)¶ Checks whether the user is allowed to manage this request type
Parameters: user – a User
-
classmethod
create_form
(event, existing_request=None)¶ Creates 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)¶ Creates 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
()¶ Returns 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_template
(name, **context)¶ Gets 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)¶ Saves 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)¶ Rejects 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)¶ Renders the request form
Parameters: - event – the event the request is for
- kwargs – arguments passed to the template
-
classmethod
send
(req, data)¶ Sends 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)¶ Withdraws the request
Parameters: - req – the
Request
of the request - notify_event_managers – if event managers should be notified
- req – the
-
classmethod