code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def locator(self):
"""A locator suitable for 'display' pages.
Instead of the numeric ID it uses the UUID.
"""
assert self.uuid is not None
return dict(self.registration_form.locator, invitation=self.uuid) | A locator suitable for 'display' pages.
Instead of the numeric ID it uses the UUID.
| locator | python | indico/indico | indico/modules/events/registration/models/invitations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/invitations.py | MIT |
def _get_next_position(context):
"""Get the next position for a form item."""
regform_id = context.current_parameters['registration_form_id']
parent_id = context.current_parameters['parent_id']
res = (db.session.query(db.func.max(RegistrationFormItem.position))
.filter(RegistrationFormItem.pa... | Get the next position for a form item. | _get_next_position | python | indico/indico | indico/modules/events/registration/models/items.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/items.py | MIT |
def column(self):
"""
The Registration column in which the value is stored in
addition to the regular registration data entry.
"""
if self in {PersonalDataType.email, PersonalDataType.first_name, PersonalDataType.last_name}:
return self.name
else:
... |
The Registration column in which the value is stored in
addition to the regular registration data entry.
| column | python | indico/indico | indico/modules/events/registration/models/items.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/items.py | MIT |
def get_locked_reason(self, registration):
"""Get the reason for the field being locked."""
values = values_from_signal(signals.event.is_field_data_locked.send(self, registration=registration))
return next((reason for reason in values if reason), None) | Get the reason for the field being locked. | get_locked_reason | python | indico/indico | indico/modules/events/registration/models/items.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/items.py | MIT |
def log(self, *args, **kwargs):
"""Log with prefilled metadata for the item."""
kwargs.setdefault('data', {}).update(self._get_default_log_data())
return self.registration_form.event.log(*args, meta={'registration_form_item_id': self.id}, **kwargs) | Log with prefilled metadata for the item. | log | python | indico/indico | indico/modules/events/registration/models/items.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/items.py | MIT |
def _get_next_friendly_id(context):
"""Get the next friendly id for a registration."""
from indico.modules.events import Event
event_id = context.current_parameters['event_id']
assert event_id is not None
return increment_and_get(Event._last_friendly_registration_id, Event.id == event_id) | Get the next friendly id for a registration. | _get_next_friendly_id | python | indico/indico | indico/modules/events/registration/models/registrations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/registrations.py | MIT |
def get_all_for_event(cls, event):
"""Retrieve all registrations in all registration forms of an event."""
from indico.modules.events.registration.models.forms import RegistrationForm
return (Registration.query
.filter(Registration.is_active,
~Registration... | Retrieve all registrations in all registration forms of an event. | get_all_for_event | python | indico/indico | indico/modules/events/registration/models/registrations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/registrations.py | MIT |
def locator(self):
"""A locator suitable for 'display' pages.
It includes the UUID of the registration unless the current
request doesn't contain the uuid and the registration is tied
to the currently logged-in user.
"""
loc = self.registration_form.locator
if (n... | A locator suitable for 'display' pages.
It includes the UUID of the registration unless the current
request doesn't contain the uuid and the registration is tied
to the currently logged-in user.
| locator | python | indico/indico | indico/modules/events/registration/models/registrations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/registrations.py | MIT |
def is_paid(self):
"""Return whether the registration has been paid for."""
paid_states = {TransactionStatus.successful, TransactionStatus.pending}
return self.transaction is not None and self.transaction.status in paid_states | Return whether the registration has been paid for. | is_paid | python | indico/indico | indico/modules/events/registration/models/registrations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/registrations.py | MIT |
def price(self):
"""The total price of the registration.
This includes the base price, the field-specific price, and
the custom price adjustment for the registrant.
:rtype: Decimal
"""
# we convert the calculated price (float) to a string to avoid this:
# >>> De... | The total price of the registration.
This includes the base price, the field-specific price, and
the custom price adjustment for the registrant.
:rtype: Decimal
| price | python | indico/indico | indico/modules/events/registration/models/registrations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/registrations.py | MIT |
def get_summary_data(self, *, hide_empty=False):
"""Export registration data nested in sections and fields."""
def _fill_from_regform():
sections = self.sections_with_answered_fields if hide_empty else self.registration_form.sections
for section in sections:
if n... | Export registration data nested in sections and fields. | get_summary_data | python | indico/indico | indico/modules/events/registration/models/registrations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/registrations.py | MIT |
def get_full_name(self, *, last_name_first=True, last_name_upper=False, abbrev_first_name=False):
"""Return the user's name in the specified notation.
If no format options are specified, the name is returned in
the 'Lastname, Firstname' notation.
:param last_name_first: if "lastname, f... | Return the user's name in the specified notation.
If no format options are specified, the name is returned in
the 'Lastname, Firstname' notation.
:param last_name_first: if "lastname, firstname" instead of
"firstname lastname" should be used
:param last_... | get_full_name | python | indico/indico | indico/modules/events/registration/models/registrations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/registrations.py | MIT |
def get_personal_data_picture(self):
"""Return the picture data in personal data."""
rdata = next((d for d in self.data if d.field_data.field.personal_data_type == PersonalDataType.picture), None)
if rdata and rdata.storage_file_id is not None:
return rdata | Return the picture data in personal data. | get_personal_data_picture | python | indico/indico | indico/modules/events/registration/models/registrations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/registrations.py | MIT |
def get_picture_attachments(self, *, personal_data_only=False):
"""Return a list of registration pictures as `MimeImage` attachments.
:param personal_data_only: If True, return only the main picture from personal data
"""
from indico.modules.events.registration.util import process_regis... | Return a list of registration pictures as `MimeImage` attachments.
:param personal_data_only: If True, return only the main picture from personal data
| get_picture_attachments | python | indico/indico | indico/modules/events/registration/models/registrations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/registrations.py | MIT |
def sync_state(self, _skip_moderation=True):
"""Sync the state of the registration."""
initial_state = self.state
regform = self.registration_form
invitation = self.invitation
moderation_required = (regform.moderation_enabled and not _skip_moderation and
... | Sync the state of the registration. | sync_state | python | indico/indico | indico/modules/events/registration/models/registrations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/registrations.py | MIT |
def update_state(self, approved=None, paid=None, rejected=None, withdrawn=None, _skip_moderation=False):
"""Update the state of the registration for a given action.
The accepted kwargs are the possible actions. ``True`` means that the
action occured and ``False`` that it was reverted.
"... | Update the state of the registration for a given action.
The accepted kwargs are the possible actions. ``True`` means that the
action occured and ``False`` that it was reverted.
| update_state | python | indico/indico | indico/modules/events/registration/models/registrations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/registrations.py | MIT |
def reset_state(self):
"""Reset the state of the registration back to pending."""
if self.has_conflict():
raise IndicoError(_('Cannot reset this registration since there is another valid registration for the '
'same user or email.'))
if self.state in (... | Reset the state of the registration back to pending. | reset_state | python | indico/indico | indico/modules/events/registration/models/registrations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/registrations.py | MIT |
def has_conflict(self):
"""Check if there are other valid registrations for the same user.
This is intended for cases where this registration is currenly invalid
(rejected or withdrawn) to determine whether it would be acceptable to
restore it.
"""
conflict_criteria = [R... | Check if there are other valid registrations for the same user.
This is intended for cases where this registration is currenly invalid
(rejected or withdrawn) to determine whether it would be acceptable to
restore it.
| has_conflict | python | indico/indico | indico/modules/events/registration/models/registrations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/registrations.py | MIT |
def is_pending_transaction_expired(self):
"""Check if the registration has a pending transaction that expired."""
if not self.transaction or self.transaction.status != TransactionStatus.pending:
return False
return self.transaction.is_pending_expired() | Check if the registration has a pending transaction that expired. | is_pending_transaction_expired | python | indico/indico | indico/modules/events/registration/models/registrations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/registrations.py | MIT |
def generate_ticket_google_wallet_url(self):
"""Return link to Google Wallet ticket display."""
if not self.registration_form.ticket_google_wallet:
return None
gwm = GoogleWalletManager(self.event)
if gwm.is_configured:
return gwm.get_ticket_link(self) | Return link to Google Wallet ticket display. | generate_ticket_google_wallet_url | python | indico/indico | indico/modules/events/registration/models/registrations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/registrations.py | MIT |
def generate_ticket_apple_wallet(self):
"""Download ticket in Passbook / Apple Wallet format."""
if not self.registration_form.ticket_apple_wallet:
return None
awm = AppleWalletManager(self.event)
if awm.is_configured:
return awm.get_ticket(self) | Download ticket in Passbook / Apple Wallet format. | generate_ticket_apple_wallet | python | indico/indico | indico/modules/events/registration/models/registrations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/registrations.py | MIT |
def locator(self):
"""A locator that points to the associated file."""
if not self.filename:
raise Exception('The file locator is only available if there is a file.')
return dict(self.registration.locator, field_data_id=self.field_data_id, filename=self.filename) | A locator that points to the associated file. | locator | python | indico/indico | indico/modules/events/registration/models/registrations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/registrations.py | MIT |
def locator(self):
"""A locator that points to the associated file for a registrant."""
if not self.filename:
raise Exception('The file locator is only available if there is a file.')
return dict(self.registration.locator.registrant, registration_id=self.registration.id,
... | A locator that points to the associated file for a registrant. | locator | python | indico/indico | indico/modules/events/registration/models/registrations.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/models/registrations.py | MIT |
def create_regform(db):
"""Return a callable that lets you create a registration form."""
def _create_regform(event, title='Registration Form', currency='USD', **kwargs):
regform = RegistrationForm(event=event, title=title, currency=currency, **kwargs)
create_personal_data_fields(regform)
... | Return a callable that lets you create a registration form. | create_regform | python | indico/indico | indico/modules/events/registration/testing/fixtures.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/testing/fixtures.py | MIT |
def dummy_reg(db, dummy_event, dummy_regform, dummy_user):
"""Create a dummy registration for the dummy event."""
reg = Registration(
registration_form_id=dummy_regform.id,
first_name='Guinea',
last_name='Pig',
checked_in=True,
state=RegistrationState.complete,
cu... | Create a dummy registration for the dummy event. | dummy_reg | python | indico/indico | indico/modules/events/registration/testing/fixtures.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/testing/fixtures.py | MIT |
def create_registration(dummy_event):
"""Return a callable that lets you create a registration."""
def _create_registration(user, regform, **kwargs):
return Registration(
first_name='Guinea',
last_name='Pig',
checked_in=True,
state=RegistrationState.compl... | Return a callable that lets you create a registration. | create_registration | python | indico/indico | indico/modules/events/registration/testing/fixtures.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/testing/fixtures.py | MIT |
def _createSignature(self, manifest, certificate, key, wwdr_certificate, password): # noqa: N802
"""Creates a signature (DER encoded) of the manifest.
Rewritten to use cryptography library instead of M2Crypto
The manifest is the file containing a list of files included in the pass file (and th... | Creates a signature (DER encoded) of the manifest.
Rewritten to use cryptography library instead of M2Crypto
The manifest is the file containing a list of files included in the pass file (and their hashes).
| _createSignature | python | indico/indico | indico/modules/events/registration/wallets/apple.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/wallets/apple.py | MIT |
def _load_credentials(self):
"""Load Google credentials and setup authenticated HTTP client."""
if not self.is_configured:
return None, None
credentials = Credentials.from_service_account_info(
self.settings['google_wallet_credentials'],
scopes=['https://www.g... | Load Google credentials and setup authenticated HTTP client. | _load_credentials | python | indico/indico | indico/modules/events/registration/wallets/google.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/wallets/google.py | MIT |
def class_id(self):
"""The unique identifier for an event ticket class.
Each event has one ticket class that holds shared data such as the title
and dates of the event.
"""
# If we have an ID stored we use that one. It should always be identical to the default,
# unless ... | The unique identifier for an event ticket class.
Each event has one ticket class that holds shared data such as the title
and dates of the event.
| class_id | python | indico/indico | indico/modules/events/registration/wallets/google.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/wallets/google.py | MIT |
def build_class_data(self) -> dict:
"""This method will return a dict format ticket class template."""
from indico.modules.categories.controllers.util import make_format_event_date_func
logo_url = config.ABSOLUTE_WALLET_LOGO_URL or f'{config.BASE_URL}{config.IMAGES_BASE_URL}/logo_indico_small.pn... | This method will return a dict format ticket class template. | build_class_data | python | indico/indico | indico/modules/events/registration/wallets/google.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/wallets/google.py | MIT |
def build_ticket_object_data(self, registration) -> dict:
"""Generate the object data for an individual ticket."""
from indico.modules.events.registration.util import get_persons, get_ticket_qr_code_data
qr_data = get_ticket_qr_code_data(get_persons([registration])[0])
data = {
... | Generate the object data for an individual ticket. | build_ticket_object_data | python | indico/indico | indico/modules/events/registration/wallets/google.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/wallets/google.py | MIT |
def create_ticket_class(self, *, update: bool = False) -> str:
"""Create a ticket class in Google Wallet.
If it already exists nothing is done, unless `update` is specified.
"""
resp = self.http_client.get(f'{API_CLASS_URL}/{self._make_id(self.class_id)}')
if resp.status_code ==... | Create a ticket class in Google Wallet.
If it already exists nothing is done, unless `update` is specified.
| create_ticket_class | python | indico/indico | indico/modules/events/registration/wallets/google.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/wallets/google.py | MIT |
def patch_ticket_class(self):
"""Silently update a ticket class in Google Wallet.
This method fails silently and just logs errors to allow making changes
to an event even if something fails when making requests to the Wallet API.
"""
resp = self.http_client.get(f'{API_CLASS_URL}... | Silently update a ticket class in Google Wallet.
This method fails silently and just logs errors to allow making changes
to an event even if something fails when making requests to the Wallet API.
| patch_ticket_class | python | indico/indico | indico/modules/events/registration/wallets/google.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/wallets/google.py | MIT |
def create_ticket_object(self, registration, *, update: bool = False) -> str:
"""Create a ticket object in Google Wallet.
If it already exists nothing is done, unless `update` is specified.
"""
object_id = registration.google_wallet_ticket_id
resp = self.http_client.get(f'{API_O... | Create a ticket object in Google Wallet.
If it already exists nothing is done, unless `update` is specified.
| create_ticket_object | python | indico/indico | indico/modules/events/registration/wallets/google.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/wallets/google.py | MIT |
def patch_ticket_object(self, registration):
"""Silently update a ticket object in Google Wallet.
If the object does not exist, no action is performed.
"""
object_id = registration.google_wallet_ticket_id
resp = self.http_client.get(f'{API_OBJECT_URL}/{self._make_id(object_id)}'... | Silently update a ticket object in Google Wallet.
If the object does not exist, no action is performed.
| patch_ticket_object | python | indico/indico | indico/modules/events/registration/wallets/google.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/wallets/google.py | MIT |
def get_ticket_link(self, registration) -> str:
"""Create a Google Wallet link for the linked registration."""
ticket_class_id = self.create_ticket_class()
ticket_object_id = self.create_ticket_object(registration)
claims = {
'iss': self.credentials.service_account_email,
... | Create a Google Wallet link for the linked registration. | get_ticket_link | python | indico/indico | indico/modules/events/registration/wallets/google.py | https://github.com/indico/indico/blob/master/indico/modules/events/registration/wallets/google.py | MIT |
def make_reminder_email(event, with_agenda, with_description, note):
"""Return the template module for the reminder email.
:param event: The event
:param with_agenda: If the event's agenda should be included
:param note: A custom message to include in the email
"""
if event.type_ == EventType.l... | Return the template module for the reminder email.
:param event: The event
:param with_agenda: If the event's agenda should be included
:param note: A custom message to include in the email
| make_reminder_email | python | indico/indico | indico/modules/events/reminders/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/reminders/util.py | MIT |
def all_recipients(self):
"""Return all recipients of the notifications.
This includes both explicit recipients and, if enabled,
participants/speakers of the event.
"""
recipients = set(self.recipients)
if self.send_to_participants:
recipients.update(reg.emai... | Return all recipients of the notifications.
This includes both explicit recipients and, if enabled,
participants/speakers of the event.
| all_recipients | python | indico/indico | indico/modules/events/reminders/models/reminders.py | https://github.com/indico/indico/blob/master/indico/modules/events/reminders/models/reminders.py | MIT |
def send(self):
"""Send the reminder to its recipients."""
self.is_sent = True
recipients = self.all_recipients
if not recipients:
logger.info('Notification %s has no recipients; not sending anything', self)
return
with self.event.force_event_locale():
... | Send the reminder to its recipients. | send | python | indico/indico | indico/modules/events/reminders/models/reminders.py | https://github.com/indico/indico/blob/master/indico/modules/events/reminders/models/reminders.py | MIT |
def render_form(cls, event, **kwargs):
"""Render the request form.
:param event: the event the request is for
:param kwargs: arguments passed to the template
"""
tpl = get_overridable_template_name('event_request_details.html', cls.plugin, 'events/requests/')
return WPRe... | Render the request form.
:param event: the event the request is for
:param kwargs: arguments passed to the template
| render_form | python | indico/indico | indico/modules/events/requests/base.py | https://github.com/indico/indico/blob/master/indico/modules/events/requests/base.py | MIT |
def create_form(cls, event, existing_request=None):
"""Create the request form.
:param event: the event the request is for
:param existing_request: the :class:`Request` if there's an existing request of this type
:return: an instance of an :class:`IndicoForm` subclass
"""
... | Create the request form.
:param event: the event the request is for
:param existing_request: the :class:`Request` if there's an existing request of this type
:return: an instance of an :class:`IndicoForm` subclass
| create_form | python | indico/indico | indico/modules/events/requests/base.py | https://github.com/indico/indico/blob/master/indico/modules/events/requests/base.py | MIT |
def create_manager_form(cls, req):
"""Create the request management form.
:param req: the :class:`Request` of the request
:return: an instance of an :class:`IndicoForm` subclass
"""
defaults = FormDefaults(req, **req.data)
with plugin_context(cls.plugin):
ret... | Create the request management form.
:param req: the :class:`Request` of the request
:return: an instance of an :class:`IndicoForm` subclass
| create_manager_form | python | indico/indico | indico/modules/events/requests/base.py | https://github.com/indico/indico/blob/master/indico/modules/events/requests/base.py | MIT |
def get_notification_template(cls, name, **context):
"""Get the template module for a notification email.
:param name: the template name
:param context: data passed to the template
"""
tpl = get_overridable_template_name(name, cls.plugin, 'events/requests/emails/', 'emails/')
... | Get the template module for a notification email.
:param name: the template name
:param context: data passed to the template
| get_notification_template | python | indico/indico | indico/modules/events/requests/base.py | https://github.com/indico/indico/blob/master/indico/modules/events/requests/base.py | MIT |
def make_notification_email(cls, req, template, *, to_request_managers: bool):
"""Make a notification email.
:param req: the :class:`Request` of the request
:param template: the template module for the notification
:param to_request_managers: whether the email is sent to request manager... | Make a notification email.
:param req: the :class:`Request` of the request
:param template: the template module for the notification
:param to_request_managers: whether the email is sent to request managers
(event managers if False)
| make_notification_email | python | indico/indico | indico/modules/events/requests/base.py | https://github.com/indico/indico/blob/master/indico/modules/events/requests/base.py | MIT |
def send(cls, req, data):
"""Send a new/modified request.
:param req: the :class:`Request` of the request
:param data: the form data from the request form
"""
req.data = (req.data or {}) | data
is_new = req.id is None
if is_new:
db.session.add(req)
... | Send a new/modified request.
:param req: the :class:`Request` of the request
:param data: the form data from the request form
| send | python | indico/indico | indico/modules/events/requests/base.py | https://github.com/indico/indico/blob/master/indico/modules/events/requests/base.py | MIT |
def withdraw(cls, req, notify_event_managers=True):
"""Withdraw the request.
:param req: the :class:`Request` of the request
:param notify_event_managers: if event managers should be notified
"""
from indico.modules.events.requests.models.requests import RequestState
req... | Withdraw the request.
:param req: the :class:`Request` of the request
:param notify_event_managers: if event managers should be notified
| withdraw | python | indico/indico | indico/modules/events/requests/base.py | https://github.com/indico/indico/blob/master/indico/modules/events/requests/base.py | MIT |
def accept(cls, req, data, user):
"""Accept the request.
To ensure that additional data is saved, this method should
call :method:`manager_save`.
:param req: the :class:`Request` of the request
:param data: the form data from the management form
:param user: the user pr... | Accept the request.
To ensure that additional data is saved, this method should
call :method:`manager_save`.
:param req: the :class:`Request` of the request
:param data: the form data from the management form
:param user: the user processing the request
| accept | python | indico/indico | indico/modules/events/requests/base.py | https://github.com/indico/indico/blob/master/indico/modules/events/requests/base.py | MIT |
def reject(cls, req, data, user):
"""Reject the request.
To ensure that additional data is saved, this method should
call :method:`manager_save`.
:param req: the :class:`Request` of the request
:param data: the form data from the management form
:param user: the user pr... | Reject the request.
To ensure that additional data is saved, this method should
call :method:`manager_save`.
:param req: the :class:`Request` of the request
:param data: the form data from the management form
:param user: the user processing the request
| reject | python | indico/indico | indico/modules/events/requests/base.py | https://github.com/indico/indico/blob/master/indico/modules/events/requests/base.py | MIT |
def _get_template_module(name, req, **context):
"""Get template module for a request email notification template.
:param name: template name
:param req: :class:`Request` instance
:param context: data passed to the template
"""
context['req'] = req
return req.definition.get_notification_temp... | Get template module for a request email notification template.
:param name: template name
:param req: :class:`Request` instance
:param context: data passed to the template
| _get_template_module | python | indico/indico | indico/modules/events/requests/notifications.py | https://github.com/indico/indico/blob/master/indico/modules/events/requests/notifications.py | MIT |
def notify_request_managers(req, template, **context):
"""Notify request managers about something.
:param req: the :class:`Request`
:param template: the template for the notification
:param context: data passed to the template
"""
context['event'] = req.event
context['req'] = req
with r... | Notify request managers about something.
:param req: the :class:`Request`
:param template: the template for the notification
:param context: data passed to the template
| notify_request_managers | python | indico/indico | indico/modules/events/requests/notifications.py | https://github.com/indico/indico/blob/master/indico/modules/events/requests/notifications.py | MIT |
def notify_event_managers(req, template, **context):
"""Notify event managers about something.
:param req: the :class:`Request`
:param template: the template for the notification
:param context: data passed to the template
"""
context['event'] = req.event
context['req'] = req
with req.e... | Notify event managers about something.
:param req: the :class:`Request`
:param template: the template for the notification
:param context: data passed to the template
| notify_event_managers | python | indico/indico | indico/modules/events/requests/notifications.py | https://github.com/indico/indico/blob/master/indico/modules/events/requests/notifications.py | MIT |
def notify_new_modified_request(req, new):
"""Notify event managers and request managers about a new/modified request.
:param req: the :class:`Request`
:param new: True if it's a new request
"""
yield notify_event_managers(req, 'new_modified_to_event_managers.txt', new=new)
yield notify_request... | Notify event managers and request managers about a new/modified request.
:param req: the :class:`Request`
:param new: True if it's a new request
| notify_new_modified_request | python | indico/indico | indico/modules/events/requests/notifications.py | https://github.com/indico/indico/blob/master/indico/modules/events/requests/notifications.py | MIT |
def notify_withdrawn_request(req, email_event_managers):
"""Notify event managers and request managers about a withdrawn request.
:param req: the :class:`Request`
:param email_event_managers: if event managers should be notified
"""
if email_event_managers:
yield notify_event_managers(req, ... | Notify event managers and request managers about a withdrawn request.
:param req: the :class:`Request`
:param email_event_managers: if event managers should be notified
| notify_withdrawn_request | python | indico/indico | indico/modules/events/requests/notifications.py | https://github.com/indico/indico/blob/master/indico/modules/events/requests/notifications.py | MIT |
def notify_accepted_request(req):
"""Notify event managers and request managers about a accepted request.
:param req: the :class:`Request`
"""
yield notify_event_managers(req, 'accepted_to_event_managers.txt')
yield notify_request_managers(req, 'accepted_to_request_managers.txt') | Notify event managers and request managers about a accepted request.
:param req: the :class:`Request`
| notify_accepted_request | python | indico/indico | indico/modules/events/requests/notifications.py | https://github.com/indico/indico/blob/master/indico/modules/events/requests/notifications.py | MIT |
def notify_rejected_request(req):
"""Notify event managers and request managers about a rejected request.
:param req: the :class:`Request`
"""
yield notify_event_managers(req, 'rejected_to_event_managers.txt')
yield notify_request_managers(req, 'rejected_to_request_managers.txt') | Notify event managers and request managers about a rejected request.
:param req: the :class:`Request`
| notify_rejected_request | python | indico/indico | indico/modules/events/requests/notifications.py | https://github.com/indico/indico/blob/master/indico/modules/events/requests/notifications.py | MIT |
def is_request_manager(user):
"""Check if the user manages any request types."""
if not user:
return False
return any(def_.can_be_managed(user) for def_ in get_request_definitions().values()) | Check if the user manages any request types. | is_request_manager | python | indico/indico | indico/modules/events/requests/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/requests/util.py | MIT |
def find_latest_for_event(cls, event, type_=None):
"""Return the latest requests for a given event.
:param event: the event to find the requests for
:param type_: the request type to retrieve, or `None` to get all
:return: a dict mapping request types to a :class:`Request`
... | Return the latest requests for a given event.
:param event: the event to find the requests for
:param type_: the request type to retrieve, or `None` to get all
:return: a dict mapping request types to a :class:`Request`
or if `type_` was specified, a single :class:`Request` or ... | find_latest_for_event | python | indico/indico | indico/modules/events/requests/models/requests.py | https://github.com/indico/indico/blob/master/indico/modules/events/requests/models/requests.py | MIT |
def generate_session_component(
session: Session,
related_to_uid: str | None = None,
organizer: tuple[str, str] | None = None
):
"""Generate an Event iCalendar component from an Indico Session."""
uid = f'indico-session-{session.id}@{urlsplit(config.BASE_URL).hostname}'
url = url_for('sessions.d... | Generate an Event iCalendar component from an Indico Session. | generate_session_component | python | indico/indico | indico/modules/events/sessions/ical.py | https://github.com/indico/indico/blob/master/indico/modules/events/sessions/ical.py | MIT |
def generate_session_block_component(
block: SessionBlock,
related_to_uid: str | None = None,
organizer: tuple[str, str] | None = None
):
"""Generate an Event iCalendar component for a session block in an Indico Session."""
uid = f'indico-session-block-{block.id}@{urlsplit(config.BASE_URL).hostname}... | Generate an Event iCalendar component for a session block in an Indico Session. | generate_session_block_component | python | indico/indico | indico/modules/events/sessions/ical.py | https://github.com/indico/indico/blob/master/indico/modules/events/sessions/ical.py | MIT |
def session_to_ical(
session: Session,
user: User | None = None,
detailed: bool = False,
organizer: tuple[str, str] | None = None
):
"""Serialize a session into an iCal.
:param session: The session to serialize
:param detailed: If True, iCal will include the session's contributions
:par... | Serialize a session into an iCal.
:param session: The session to serialize
:param detailed: If True, iCal will include the session's contributions
:param organizer: ORGANIZER field of the iCalendar object
| session_to_ical | python | indico/indico | indico/modules/events/sessions/ical.py | https://github.com/indico/indico/blob/master/indico/modules/events/sessions/ical.py | MIT |
def create_session(event, data):
"""Create a new session with the information passed in the `data` argument."""
event_session = Session(event=event)
event_session.populate_from_dict(data)
db.session.flush()
event.log(EventLogRealm.management, LogKind.positive, 'Sessions',
f'Session "{e... | Create a new session with the information passed in the `data` argument. | create_session | python | indico/indico | indico/modules/events/sessions/operations.py | https://github.com/indico/indico/blob/master/indico/modules/events/sessions/operations.py | MIT |
def update_session(event_session, data):
"""Update a session based on the information in the `data`."""
changes = event_session.populate_from_dict(data)
db.session.flush()
signals.event.session_updated.send(event_session, changes=changes)
event_session.event.log(EventLogRealm.management, LogKind.cha... | Update a session based on the information in the `data`. | update_session | python | indico/indico | indico/modules/events/sessions/operations.py | https://github.com/indico/indico/blob/master/indico/modules/events/sessions/operations.py | MIT |
def update_session_block(session_block, data):
"""Update a session block with data passed in the `data` argument."""
from indico.modules.events.timetable.operations import update_timetable_entry
start_dt = data.pop('start_dt', None)
if start_dt is not None:
session_block.timetable_entry.move(st... | Update a session block with data passed in the `data` argument. | update_session_block | python | indico/indico | indico/modules/events/sessions/operations.py | https://github.com/indico/indico/blob/master/indico/modules/events/sessions/operations.py | MIT |
def can_manage_sessions(user, event, permission=None):
"""Check whether a user can manage any sessions in an event."""
if event.can_manage(user):
return True
return any(s.can_manage(user, permission)
for s in Session.query.with_parent(event).options(joinedload('acl_entries'))) | Check whether a user can manage any sessions in an event. | can_manage_sessions | python | indico/indico | indico/modules/events/sessions/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/sessions/util.py | MIT |
def generate_spreadsheet_from_sessions(sessions):
"""Generate spreadsheet data from a given session list.
:param sessions: The sessions to include in the spreadsheet
"""
column_names = ['ID', 'Title', 'Description', 'Type', 'Code']
rows = [{'ID': sess.friendly_id,
'Title': sess.title,
... | Generate spreadsheet data from a given session list.
:param sessions: The sessions to include in the spreadsheet
| generate_spreadsheet_from_sessions | python | indico/indico | indico/modules/events/sessions/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/sessions/util.py | MIT |
def session_coordinator_priv_enabled(event, priv):
"""Check whether a coordinator privilege is enabled.
Currently the following privileges are available:
- manage-contributions
- manage-blocks
:param event: The `Event` to check for
:param priv: The name of the privilege
"""
from indic... | Check whether a coordinator privilege is enabled.
Currently the following privileges are available:
- manage-contributions
- manage-blocks
:param event: The `Event` to check for
:param priv: The name of the privilege
| session_coordinator_priv_enabled | python | indico/indico | indico/modules/events/sessions/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/sessions/util.py | MIT |
def get_events_with_linked_sessions(user, dt=None):
"""
Return a dict with keys representing event_id and the values containing
data about the user rights for sessions within the event.
:param user: A `User`
:param dt: Only include events taking place on/after that date
"""
query = (user.in... |
Return a dict with keys representing event_id and the values containing
data about the user rights for sessions within the event.
:param user: A `User`
:param dt: Only include events taking place on/after that date
| get_events_with_linked_sessions | python | indico/indico | indico/modules/events/sessions/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/sessions/util.py | MIT |
def _get_next_friendly_id(context):
"""Get the next friendly id for a session."""
from indico.modules.events import Event
event_id = context.current_parameters['event_id']
assert event_id is not None
return increment_and_get(Event._last_friendly_session_id, Event.id == event_id) | Get the next friendly id for a session. | _get_next_friendly_id | python | indico/indico | indico/modules/events/sessions/models/sessions.py | https://github.com/indico/indico/blob/master/indico/modules/events/sessions/models/sessions.py | MIT |
def can_manage_contributions(self, user, allow_admin=True):
"""Check whether a user can manage contributions within the session."""
from indico.modules.events.sessions.util import session_coordinator_priv_enabled
if user is None:
return False
elif self.session.can_manage(user... | Check whether a user can manage contributions within the session. | can_manage_contributions | python | indico/indico | indico/modules/events/sessions/models/sessions.py | https://github.com/indico/indico/blob/master/indico/modules/events/sessions/models/sessions.py | MIT |
def can_manage_blocks(self, user, allow_admin=True):
"""Check whether a user can manage session blocks.
This only applies to the blocks themselves, not to contributions inside them.
"""
from indico.modules.events.sessions.util import session_coordinator_priv_enabled
if user is N... | Check whether a user can manage session blocks.
This only applies to the blocks themselves, not to contributions inside them.
| can_manage_blocks | python | indico/indico | indico/modules/events/sessions/models/sessions.py | https://github.com/indico/indico/blob/master/indico/modules/events/sessions/models/sessions.py | MIT |
def create_static_site(rh, event):
"""Create a static (offline) version of an Indico event.
:param rh: Request handler object
:param event: Event in question
:return: Path to the resulting ZIP file
"""
try:
g.static_site = True
g.rh = rh
cls = StaticEventCreator if event... | Create a static (offline) version of an Indico event.
:param rh: Request handler object
:param event: Event in question
:return: Path to the resulting ZIP file
| create_static_site | python | indico/indico | indico/modules/events/static/offline.py | https://github.com/indico/indico/blob/master/indico/modules/events/static/offline.py | MIT |
def create(self):
"""Trigger the creation of a ZIP file containing the site."""
temp_file = NamedTemporaryFile( # noqa: SIM115
prefix=f'static-{self.event.id}-', suffix='.zip', dir=config.TEMP_DIR,
delete=False
)
self._zip_file = ZipFile(temp_file.name, 'w', allo... | Trigger the creation of a ZIP file containing the site. | create | python | indico/indico | indico/modules/events/static/offline.py | https://github.com/indico/indico/blob/master/indico/modules/events/static/offline.py | MIT |
def static_sites_cleanup(days=30):
"""Clean up old static sites.
:param days: number of days after which to remove static sites
"""
expired_sites = (StaticSite.query
.filter(StaticSite.requested_dt < (now_utc() - timedelta(days=days)),
StaticSite.state ... | Clean up old static sites.
:param days: number of days after which to remove static sites
| static_sites_cleanup | python | indico/indico | indico/modules/events/static/tasks.py | https://github.com/indico/indico/blob/master/indico/modules/events/static/tasks.py | MIT |
def _create_data_uri(url, filename):
"""Create a data url that contains the file in question."""
response = requests.get(url, verify=False) # noqa: S501
if response.status_code != 200:
# couldn't access the file
return url
data = base64.b64encode(response.content).decode()
content_t... | Create a data url that contains the file in question. | _create_data_uri | python | indico/indico | indico/modules/events/static/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/static/util.py | MIT |
def _rewrite_event_asset_url(event, url):
"""Rewrite URLs of assets such as event images.
Only assets contained within the event will be taken into account
"""
scheme, netloc, path, qs, _anchor = urlsplit(url)
netloc = netloc or current_app.config['SERVER_NAME']
scheme = scheme or 'https'
... | Rewrite URLs of assets such as event images.
Only assets contained within the event will be taken into account
| _rewrite_event_asset_url | python | indico/indico | indico/modules/events/static/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/static/util.py | MIT |
def rewrite_css_urls(event, css):
"""Rewrite CSS in order to handle url(...) properly."""
# keeping track of used URLs
used_urls = set()
used_images = set()
def _replace_url(m):
prefix = m.group(2) or ''
url = m.group(3)
if url.startswith('/event/') or re.match(r'https?:', p... | Rewrite CSS in order to handle url(...) properly. | rewrite_css_urls | python | indico/indico | indico/modules/events/static/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/static/util.py | MIT |
def url_to_static_filename(endpoint, url):
"""Handle special endpoint/URLs so that they link to offline content."""
if re.match(r'(events)?\.display(_overview)?$', endpoint):
return 'index.html'
elif endpoint == 'event_layout.css_display':
return 'custom.css'
elif endpoint == 'event_imag... | Handle special endpoint/URLs so that they link to offline content. | url_to_static_filename | python | indico/indico | indico/modules/events/static/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/static/util.py | MIT |
def collect_static_files():
"""Keep track of URLs used by manifest and url_for."""
g.custom_manifests = {None: RewrittenManifest(current_webpack.manifest)}
g.used_url_for_assets = set()
used_assets = set()
yield used_assets
for manifest in g.custom_manifests.values():
used_assets |= {p f... | Keep track of URLs used by manifest and url_for. | collect_static_files | python | indico/indico | indico/modules/events/static/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/static/util.py | MIT |
def add_survey_question(section, field_cls, data):
"""Add a question to a survey.
:param section: The `SurveySection` to which the question will be added.
:param field_cls: The field class of this question.
:param data: The `FieldConfigForm.data` to populate the question with.
:return: The added `S... | Add a question to a survey.
:param section: The `SurveySection` to which the question will be added.
:param field_cls: The field class of this question.
:param data: The `FieldConfigForm.data` to populate the question with.
:return: The added `SurveyQuestion`.
| add_survey_question | python | indico/indico | indico/modules/events/surveys/operations.py | https://github.com/indico/indico/blob/master/indico/modules/events/surveys/operations.py | MIT |
def add_survey_text(section, data):
"""Add a text item to a survey.
:param section: The `SurveySection` to which the question will be added.
:param data: The `TextForm.data` to populate the question with.
:return: The added `SurveyText`.
"""
text = SurveyText()
text.populate_from_dict(data)... | Add a text item to a survey.
:param section: The `SurveySection` to which the question will be added.
:param data: The `TextForm.data` to populate the question with.
:return: The added `SurveyText`.
| add_survey_text | python | indico/indico | indico/modules/events/surveys/operations.py | https://github.com/indico/indico/blob/master/indico/modules/events/surveys/operations.py | MIT |
def add_survey_section(survey, data):
"""Add a section to a survey.
:param survey: The `Survey` to which the section will be added.
:param data: Attributes of the new `SurveySection`.
:return: The added `SurveySection`.
"""
section = SurveySection(survey=survey)
section.populate_from_dict(d... | Add a section to a survey.
:param survey: The `Survey` to which the section will be added.
:param data: Attributes of the new `SurveySection`.
:return: The added `SurveySection`.
| add_survey_section | python | indico/indico | indico/modules/events/surveys/operations.py | https://github.com/indico/indico/blob/master/indico/modules/events/surveys/operations.py | MIT |
def make_survey_form(survey):
"""Create a WTForm from survey questions.
Each question will use a field named ``question_ID``.
:param survey: The `Survey` for which to create the form.
:return: An `IndicoForm` subclass.
"""
form_class = type('SurveyForm', (IndicoForm,), {})
for question in... | Create a WTForm from survey questions.
Each question will use a field named ``question_ID``.
:param survey: The `Survey` for which to create the form.
:return: An `IndicoForm` subclass.
| make_survey_form | python | indico/indico | indico/modules/events/surveys/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/surveys/util.py | MIT |
def save_submitted_survey_to_session(submission):
"""Save submission of a survey to session for further checks."""
session.setdefault('submitted_surveys', {})[submission.survey.id] = submission.id
session.modified = True | Save submission of a survey to session for further checks. | save_submitted_survey_to_session | python | indico/indico | indico/modules/events/surveys/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/surveys/util.py | MIT |
def is_submission_in_progress(survey):
"""Check whether the current user has a survey submission in progress."""
from indico.modules.events.surveys.models.surveys import Survey
if session.user:
query = (Survey.query.with_parent(survey.event)
.filter(Survey.submissions.any(db.and_(~S... | Check whether the current user has a survey submission in progress. | is_submission_in_progress | python | indico/indico | indico/modules/events/surveys/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/surveys/util.py | MIT |
def generate_spreadsheet_from_survey(survey, submission_ids):
"""Generate spreadsheet data from a given survey.
:param survey: `Survey` for which the user wants to export submissions
:param submission_ids: The list of submissions to include in the file
"""
field_names = ['Submitter', 'Submitter Ema... | Generate spreadsheet data from a given survey.
:param survey: `Survey` for which the user wants to export submissions
:param submission_ids: The list of submissions to include in the file
| generate_spreadsheet_from_survey | python | indico/indico | indico/modules/events/surveys/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/surveys/util.py | MIT |
def _get_next_position(context):
"""Get the next question position for the event."""
survey_id = context.current_parameters['survey_id']
parent_id = context.current_parameters['parent_id']
res = (db.session.query(db.func.max(SurveyItem.position))
.filter(SurveyItem.survey_id == survey_id, Sur... | Get the next question position for the event. | _get_next_position | python | indico/indico | indico/modules/events/surveys/models/items.py | https://github.com/indico/indico/blob/master/indico/modules/events/surveys/models/items.py | MIT |
def _get_next_friendly_id(context):
"""Get the next friendly id for a survey submission."""
from indico.modules.events.surveys.models.surveys import Survey
survey_id = context.current_parameters['survey_id']
assert survey_id is not None
return increment_and_get(Survey._last_friendly_submission_id, S... | Get the next friendly id for a survey submission. | _get_next_friendly_id | python | indico/indico | indico/modules/events/surveys/models/submissions.py | https://github.com/indico/indico/blob/master/indico/modules/events/surveys/models/submissions.py | MIT |
def locator(self):
"""A locator that adds the UUID if the survey is private."""
token = self.uuid if self.private else None
return dict(self.locator, token=token) | A locator that adds the UUID if the survey is private. | locator | python | indico/indico | indico/modules/events/surveys/models/surveys.py | https://github.com/indico/indico/blob/master/indico/modules/events/surveys/models/surveys.py | MIT |
def start_notification_recipients(self):
"""Return all recipients of the notifications.
This includes both explicit recipients and, if enabled,
participants of the event.
"""
recipients = set(self.start_notification_emails)
if self.notify_participants:
recipi... | Return all recipients of the notifications.
This includes both explicit recipients and, if enabled,
participants of the event.
| start_notification_recipients | python | indico/indico | indico/modules/events/surveys/models/surveys.py | https://github.com/indico/indico/blob/master/indico/modules/events/surveys/models/surveys.py | MIT |
def _strip_empty_days(timetable):
"""Return the timetable without the leading and trailing empty days."""
days = sorted(timetable)
first_non_empty = next((day for day in days if timetable[day]), None)
if first_non_empty is None:
return {}
last_non_empty = next((day fo... | Return the timetable without the leading and trailing empty days. | _strip_empty_days | python | indico/indico | indico/modules/events/timetable/legacy.py | https://github.com/indico/indico/blob/master/indico/modules/events/timetable/legacy.py | MIT |
def move_timetable_entry(entry: TimetableEntry, parent: TimetableEntry | None = None, day: datetime | None = None):
"""Move the `entry` to another session or top-level timetable.
:param entry: `TimetableEntry` to be moved
:param parent: If specified then the entry will be set as a child
... | Move the `entry` to another session or top-level timetable.
:param entry: `TimetableEntry` to be moved
:param parent: If specified then the entry will be set as a child
of parent
:param day: If specified then the entry will be moved to the
top-level timetabl... | move_timetable_entry | python | indico/indico | indico/modules/events/timetable/operations.py | https://github.com/indico/indico/blob/master/indico/modules/events/timetable/operations.py | MIT |
def update_timetable_entry_object(entry, data):
"""Update the `object` of a timetable entry according to its type."""
from indico.modules.events.contributions.operations import update_contribution
obj = entry.object
if entry.type == TimetableEntryType.CONTRIBUTION:
update_contribution(obj, data)... | Update the `object` of a timetable entry according to its type. | update_timetable_entry_object | python | indico/indico | indico/modules/events/timetable/operations.py | https://github.com/indico/indico/blob/master/indico/modules/events/timetable/operations.py | MIT |
def swap_timetable_entry(entry, direction, session_=None):
"""Swap entry with closest gap or non-parallel sibling."""
in_session = session_ is not None
sibling = get_sibling_entry(entry, direction=direction, in_session=in_session)
if not sibling:
return
if direction == 'down':
if ent... | Swap entry with closest gap or non-parallel sibling. | swap_timetable_entry | python | indico/indico | indico/modules/events/timetable/operations.py | https://github.com/indico/indico/blob/master/indico/modules/events/timetable/operations.py | MIT |
def find_latest_entry_end_dt(obj, day=None):
"""Get the latest end datetime for timetable entries within the object.
:param obj: The :class:`Event` or :class:`SessionBlock` that will be used to
look for timetable entries.
:param day: The local event date to look for timetable entries. Appl... | Get the latest end datetime for timetable entries within the object.
:param obj: The :class:`Event` or :class:`SessionBlock` that will be used to
look for timetable entries.
:param day: The local event date to look for timetable entries. Applicable only
to ``Event``.
:retur... | find_latest_entry_end_dt | python | indico/indico | indico/modules/events/timetable/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/timetable/util.py | MIT |
def find_next_start_dt(duration, obj, day=None, force=False):
"""Find the next most convenient start date fitting a duration within an object.
:param duration: Duration to fit into the event/session-block.
:param obj: The :class:`Event` or :class:`SessionBlock` the duration needs to
fit int... | Find the next most convenient start date fitting a duration within an object.
:param duration: Duration to fit into the event/session-block.
:param obj: The :class:`Event` or :class:`SessionBlock` the duration needs to
fit into.
:param day: The local event date where to fit the duration in ... | find_next_start_dt | python | indico/indico | indico/modules/events/timetable/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/timetable/util.py | MIT |
def get_category_timetable(categ_ids, start_dt, end_dt, detail_level='event', tz=utc, from_categ=None, grouped=True,
includible=lambda item: True):
"""Retrieve time blocks that fall within a specific time interval for a given set of categories.
:param categ_ids: iterable containing l... | Retrieve time blocks that fall within a specific time interval for a given set of categories.
:param categ_ids: iterable containing list of category IDs
:param start_dt: start of search interval (``datetime``, expected
to be in display timezone)
:param end_dt: end of search interval (`... | get_category_timetable | python | indico/indico | indico/modules/events/timetable/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/timetable/util.py | MIT |
def get_session_block_entries(event, day):
"""Return a list of event top-level session blocks for the given `day`."""
return (event.timetable_entries
.filter(db.cast(TimetableEntry.start_dt.astimezone(event.tzinfo), db.Date) == day.date(),
TimetableEntry.type == TimetableEntryTyp... | Return a list of event top-level session blocks for the given `day`. | get_session_block_entries | python | indico/indico | indico/modules/events/timetable/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/timetable/util.py | MIT |
def shift_following_entries(entry, shift, session_=None):
"""Reschedule entries starting after the given entry by the given shift."""
query = entry.siblings_query.filter(TimetableEntry.start_dt >= entry.end_dt)
if session_ and not entry.parent:
query.filter(TimetableEntry.type == TimetableEntryType.... | Reschedule entries starting after the given entry by the given shift. | shift_following_entries | python | indico/indico | indico/modules/events/timetable/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/timetable/util.py | MIT |
def can_view(self, user):
"""Check whether the user will see this entry in the timetable."""
if self.type in (TimetableEntryType.CONTRIBUTION, TimetableEntryType.BREAK):
return self.object.can_access(user)
elif self.type == TimetableEntryType.SESSION_BLOCK:
if self.object... | Check whether the user will see this entry in the timetable. | can_view | python | indico/indico | indico/modules/events/timetable/models/entries.py | https://github.com/indico/indico/blob/master/indico/modules/events/timetable/models/entries.py | MIT |
def extend_parent(self, by_start=True, by_end=True):
"""Extend start/end of parent objects if needed.
No extension if performed for entries crossing a day boundary in the
event timezone.
:param by_start: Extend parent by start datetime.
:param by_end: Extend parent by end datet... | Extend start/end of parent objects if needed.
No extension if performed for entries crossing a day boundary in the
event timezone.
:param by_start: Extend parent by start datetime.
:param by_end: Extend parent by end datetime.
| extend_parent | python | indico/indico | indico/modules/events/timetable/models/entries.py | https://github.com/indico/indico/blob/master/indico/modules/events/timetable/models/entries.py | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.