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 get(self, event, name, default=SettingsProxyBase.default_sentinel):
"""Retrieve the value of a single setting.
:param event: Event (or its ID)
:param name: Setting name
:param default: Default value in case the setting does not exist
:return: The settings's value or the defa... | Retrieve the value of a single setting.
:param event: Event (or its ID)
:param name: Setting name
:param default: Default value in case the setting does not exist
:return: The settings's value or the default value
| get | python | indico/indico | indico/modules/events/settings.py | https://github.com/indico/indico/blob/master/indico/modules/events/settings.py | MIT |
def set(self, event, name, value):
"""Set a single setting.
:param event: Event (or its ID)
:param name: Setting name
:param value: Setting value; must be JSON-serializable
"""
self._check_name(name)
EventSetting.set(self.module, name, self._convert_from_python(n... | Set a single setting.
:param event: Event (or its ID)
:param name: Setting name
:param value: Setting value; must be JSON-serializable
| set | python | indico/indico | indico/modules/events/settings.py | https://github.com/indico/indico/blob/master/indico/modules/events/settings.py | MIT |
def set_multi(self, event, items):
"""Set multiple settings at once.
:param event: Event (or its ID)
:param items: Dict containing the new settings
"""
items = {k: self._convert_from_python(k, v) for k, v in items.items()}
self._split_call(items,
... | Set multiple settings at once.
:param event: Event (or its ID)
:param items: Dict containing the new settings
| set_multi | python | indico/indico | indico/modules/events/settings.py | https://github.com/indico/indico/blob/master/indico/modules/events/settings.py | MIT |
def delete(self, event, *names):
"""Delete settings.
:param event: Event (or its ID)
:param names: One or more names of settings to delete
"""
self._split_call(names,
lambda name: EventSetting.delete(self.module, *name, event_id=event),
... | Delete settings.
:param event: Event (or its ID)
:param names: One or more names of settings to delete
| delete | python | indico/indico | indico/modules/events/settings.py | https://github.com/indico/indico/blob/master/indico/modules/events/settings.py | MIT |
def delete_all(self, event):
"""Delete all settings.
:param event: Event (or its ID)
"""
EventSetting.delete_all(self.module, event_id=event)
EventSettingPrincipal.delete_all(self.module, event_id=event)
self._flush_cache() | Delete all settings.
:param event: Event (or its ID)
| delete_all | python | indico/indico | indico/modules/events/settings.py | https://github.com/indico/indico/blob/master/indico/modules/events/settings.py | MIT |
def get_object_from_args(args=None):
"""Retrieve an event object from request arguments.
This utility is meant to be used in cases where the same controller
can deal with objects attached to various parts of an event which
use different URLs to indicate which object to use.
:param args: The reques... | Retrieve an event object from request arguments.
This utility is meant to be used in cases where the same controller
can deal with objects attached to various parts of an event which
use different URLs to indicate which object to use.
:param args: The request arguments. If unspecified,
... | get_object_from_args | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def get_theme(event, override_theme_id=None):
"""Get the theme ID and whether it's an override.
This is useful for places where a user may specify a different
timetable theme. If the override theme is not valid for the
event, a message is flashed and an exception redirecting the user
to the main e... | Get the theme ID and whether it's an override.
This is useful for places where a user may specify a different
timetable theme. If the override theme is not valid for the
event, a message is flashed and an exception redirecting the user
to the main event page is raised.
:raise BadRequest: if the o... | get_theme | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def get_events_managed_by(user, dt=None):
"""Get the IDs of events where the user has management privs.
:param user: A `User`
:param dt: Only include events taking place on/after that date
:return: A set of event ids
"""
query = (user.in_event_acls
.join(Event)
.option... | Get the IDs of events where the user has management privs.
:param user: A `User`
:param dt: Only include events taking place on/after that date
:return: A set of event ids
| get_events_managed_by | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def get_events_created_by(user, dt=None):
"""Get the IDs of events created by the user.
:param user: A `User`
:param dt: Only include events taking place on/after that date
:return: A set of event ids
"""
query = (user.created_events
.filter(~Event.is_deleted, Event.ends_after(dt))... | Get the IDs of events created by the user.
:param user: A `User`
:param dt: Only include events taking place on/after that date
:return: A set of event ids
| get_events_created_by | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def get_events_with_linked_event_persons(user, dt=None):
"""
Return a dict containing the event ids and role for all events
where the user is a chairperson or (in case of a lecture) speaker.
:param user: A `User`
:param dt: Only include events taking place on/after that date
"""
query = (us... |
Return a dict containing the event ids and role for all events
where the user is a chairperson or (in case of a lecture) speaker.
:param user: A `User`
:param dt: Only include events taking place on/after that date
| get_events_with_linked_event_persons | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def update_object_principals(obj, new_principals, read_access=False, full_access=False, permission=None):
"""Update an object's ACL with a new list of principals.
Exactly one argument out of `read_access`, `full_access` and `role` must be specified.
:param obj: The object to update. Must have ``acl_entrie... | Update an object's ACL with a new list of principals.
Exactly one argument out of `read_access`, `full_access` and `role` must be specified.
:param obj: The object to update. Must have ``acl_entries``
:param new_principals: The set containing the new principals
:param read_access: Whether the read acc... | update_object_principals | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def _get_config(self):
"""Load the list's configuration from the DB and return it."""
session_key = self._get_config_session_key()
if self.static_link_used:
uuid = request.args['config']
configuration = StaticListLink.load(self.event, self.list_link_type, uuid)
... | Load the list's configuration from the DB and return it. | _get_config | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def _split_item_ids(self, item_ids, separator_type=None):
"""Separate the dynamic item ids from the static.
:param item_ids: The list of ids to be splitted.
:param separator_type: The type of the item to base the partitioning on.
If the value is 'dynamic', the fun... | Separate the dynamic item ids from the static.
:param item_ids: The list of ids to be splitted.
:param separator_type: The type of the item to base the partitioning on.
If the value is 'dynamic', the function will
return a tuple where the fi... | _split_item_ids | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def generate_static_url(self):
"""Return a URL with a uuid referring to the list's configuration."""
session_key = self._get_config_session_key()
configuration = {
'entry_parent_id': self.entry_parent.id,
'data': session.get(session_key)
}
if configuration... | Return a URL with a uuid referring to the list's configuration. | generate_static_url | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def store_configuration(self):
"""Load the filters from the request and store them in the session."""
filters = self._get_filters_from_request()
session_key = self._get_config_session_key()
self.list_config = session.setdefault(session_key, {})
self.list_config['filters'] = filte... | Load the filters from the request and store them in the session. | store_configuration | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def create_event_logo_tmp_file(event, tmpdir=None):
"""Create a temporary file with the event's logo.
If `tmpdir` is specified, the logo file is created in there and
a path relative to that directory is returned.
"""
logo_meta = event.logo_metadata
logo_extension = guess_extension(logo_meta['co... | Create a temporary file with the event's logo.
If `tmpdir` is specified, the logo file is created in there and
a path relative to that directory is returned.
| create_event_logo_tmp_file | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def track_time_changes(auto_extend=False, user=None):
"""Track time changes of event objects.
This provides a list of changes while the context manager was
active and also triggers `times_changed` signals.
If the code running inside the ``with`` block of this context
manager raises an exception, n... | Track time changes of event objects.
This provides a list of changes while the context manager was
active and also triggers `times_changed` signals.
If the code running inside the ``with`` block of this context
manager raises an exception, no signals will be triggered.
:param auto_extend: Whether... | track_time_changes | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def register_time_change(entry):
"""Register a time-related change for a timetable entry.
This is an internal helper function used in the models to record
changes of the start time or duration. The changes are exposed
through the `track_time_changes` contextmanager function.
"""
# if it's a ne... | Register a time-related change for a timetable entry.
This is an internal helper function used in the models to record
changes of the start time or duration. The changes are exposed
through the `track_time_changes` contextmanager function.
| register_time_change | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def register_event_time_change(event):
"""Register a time-related change for an event.
This is an internal helper function used in the model to record
changes of the start time or end time. The changes are exposed
through the `track_time_changes` contextmanager function.
"""
# if it's a new ob... | Register a time-related change for an event.
This is an internal helper function used in the model to record
changes of the start time or end time. The changes are exposed
through the `track_time_changes` contextmanager function.
| register_event_time_change | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def track_location_changes():
"""Track location changes of event objects.
This provides a list of changes while the context manager was
active and also triggers `location_changed` signals.
If the code running inside the ``with`` block of this context
manager raises an exception, no signals will be... | Track location changes of event objects.
This provides a list of changes while the context manager was
active and also triggers `location_changed` signals.
If the code running inside the ``with`` block of this context
manager raises an exception, no signals will be triggered.
| track_location_changes | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def register_location_change(entry):
"""Register a location-related change for an event object.
This is an internal helper function used in the models to record
changes of the location information. The changes are exposed
through the `track_location_changes` contextmanager function.
"""
# if i... | Register a location-related change for an event object.
This is an internal helper function used in the models to record
changes of the location information. The changes are exposed
through the `track_location_changes` contextmanager function.
| register_location_change | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def get_field_values(form_data):
"""Split the form fields between custom and static."""
fields = {x: form_data[x] for x in form_data if not x.startswith('custom_')}
custom_fields = {x: form_data[x] for x in form_data if x.startswith('custom_')}
return fields, custom_fields | Split the form fields between custom and static. | get_field_values | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def get_event_from_url(url):
"""Get an event from an Indico event URL."""
data = urlsplit(url)
if not all([data.scheme, data.netloc, data.path]):
raise ValueError(_('Invalid event URL'))
event_path = re.match(r'/event/(\d+)(/|$)', data.path)
if not event_path:
raise ValueError(_('Inv... | Get an event from an Indico event URL. | get_event_from_url | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def _adjust_path_length(self, segments):
"""Shorten the path length to < 260 chars.
Windows' built-in ZIP tool doesn't like files whose
total path exceeds ~260 chars. Here we progressively
shorten the total until it matches that constraint.
"""
result = []
total_... | Shorten the path length to < 260 chars.
Windows' built-in ZIP tool doesn't like files whose
total path exceeds ~260 chars. Here we progressively
shorten the total until it matches that constraint.
| _adjust_path_length | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def _generate_zip_file(self, files_holder, name_prefix='material', name_suffix=None, return_file=False):
"""Generate a zip file containing the files passed.
:param files_holder: An iterable (or an iterable containing) object that
contains the files to be added in the zip fi... | Generate a zip file containing the files passed.
:param files_holder: An iterable (or an iterable containing) object that
contains the files to be added in the zip file.
:param name_prefix: The prefix to the zip file name
:param name_suffix: The suffix to the zip fi... | _generate_zip_file | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def split_log_location_changes(changes: dict) -> dict:
"""Re-process change dict to include readable location information (for logging)."""
res = dict(changes)
if (location_changes := res.pop('location_data', None)) is None:
return res
if location_changes[0]['address'] != location_changes[1]['... | Re-process change dict to include readable location information (for logging). | split_log_location_changes | python | indico/indico | indico/modules/events/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/util.py | MIT |
def _handle_legacy_ids(app, **kwargs):
"""
Handle the redirect from broken legacy event ids such as a12345
or 0123 which cannot be converted to an integer without an error
or losing relevant information (0123 and 123 may be different
events).
"""
# Endpoints which need to deal with non-stand... |
Handle the redirect from broken legacy event ids such as a12345
or 0123 which cannot be converted to an integer without an error
or losing relevant information (0123 and 123 may be different
events).
| _handle_legacy_ids | python | indico/indico | indico/modules/events/__init__.py | https://github.com/indico/indico/blob/master/indico/modules/events/__init__.py | MIT |
def make_review_form(event):
"""Extend the abstract WTForm to add the extra fields.
Each extra field will use a field named ``custom_ID``.
:param event: The `Event` for which to create the abstract form.
:return: An `AbstractForm` subclass.
"""
form_class = type('_AbstractReviewForm', (Abstrac... | Extend the abstract WTForm to add the extra fields.
Each extra field will use a field named ``custom_ID``.
:param event: The `Event` for which to create the abstract form.
:return: An `AbstractForm` subclass.
| make_review_form | python | indico/indico | indico/modules/events/abstracts/forms.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/forms.py | MIT |
def _get_sorted_contribution_fields(self, item_ids):
"""
Return the contribution fields ordered by their position in
the abstract form.
"""
if not item_ids or not self.show_contribution_fields:
return []
return (ContributionField.query
.with_pa... |
Return the contribution fields ordered by their position in
the abstract form.
| _get_sorted_contribution_fields | python | indico/indico | indico/modules/events/abstracts/lists.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/lists.py | MIT |
def get_abstract_notification_tpl_module(email_tpl, abstract):
"""Get the Jinja template module for a notification email.
:param email_tpl: the abstract email template used to populate the
email subject/body
:param abstract: the abstract the notification email is for
"""
subje... | Get the Jinja template module for a notification email.
:param email_tpl: the abstract email template used to populate the
email subject/body
:param abstract: the abstract the notification email is for
| get_abstract_notification_tpl_module | python | indico/indico | indico/modules/events/abstracts/notifications.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/notifications.py | MIT |
def send_abstract_notifications(abstract):
"""Send abstract notification e-mails.
:param abstract: the abstract that is going to be checked
against the event's notification rules
:return: whether an email has been sent
"""
sent = False
for email_tpl in abstract.event.abstra... | Send abstract notification e-mails.
:param abstract: the abstract that is going to be checked
against the event's notification rules
:return: whether an email has been sent
| send_abstract_notifications | python | indico/indico | indico/modules/events/abstracts/notifications.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/notifications.py | MIT |
def _merge_person_links(target_abstract, source_abstract):
"""Merge `person_links` of different abstracts.
Add to `target_abstract` new `AbstractPersonLink`s whose `EventPerson`
exists in the `source_abstract` but is not yet in the `target_abstract`.
:param target_abstract: The target abstract (to whi... | Merge `person_links` of different abstracts.
Add to `target_abstract` new `AbstractPersonLink`s whose `EventPerson`
exists in the `source_abstract` but is not yet in the `target_abstract`.
:param target_abstract: The target abstract (to which the links should then be added)
:param source_abstract: The... | _merge_person_links | python | indico/indico | indico/modules/events/abstracts/operations.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/operations.py | MIT |
def build_default_email_template(event, tpl_type):
"""
Build a default e-mail template based on a notification type
provided by the user.
"""
email = get_template_module(f'events/abstracts/emails/default_{tpl_type}_notification.txt')
return AbstractEmailTemplate(body=email.get_body(),
... |
Build a default e-mail template based on a notification type
provided by the user.
| build_default_email_template | python | indico/indico | indico/modules/events/abstracts/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/util.py | MIT |
def generate_spreadsheet_from_abstracts(abstracts, static_item_ids, dynamic_items):
"""Generate a spreadsheet data from a given abstract list.
:param abstracts: The list of abstracts to include in the file
:param static_item_ids: The abstract properties to be used as columns
:param dynamic_items: Contr... | Generate a spreadsheet data from a given abstract list.
:param abstracts: The list of abstracts to include in the file
:param static_item_ids: The abstract properties to be used as columns
:param dynamic_items: Contribution fields as extra columns
| generate_spreadsheet_from_abstracts | python | indico/indico | indico/modules/events/abstracts/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/util.py | MIT |
def create_mock_abstract(event):
"""Create a mock abstract that can be used in previews.
Brace for geek references.
"""
User = namedtuple('Author', ['first_name', 'last_name', 'title', 'full_name'])
Track = namedtuple('Track', ['title'])
Session = namedtuple('Session', ['title'])
Contributi... | Create a mock abstract that can be used in previews.
Brace for geek references.
| create_mock_abstract | python | indico/indico | indico/modules/events/abstracts/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/util.py | MIT |
def make_abstract_form(event, user, notification_option=False, management=False, invited=False):
"""Extend the abstract WTForm to add the extra fields.
Each extra field will use a field named ``custom_ID``.
:param event: The `Event` for which to create the abstract form.
:param user: The user who is g... | Extend the abstract WTForm to add the extra fields.
Each extra field will use a field named ``custom_ID``.
:param event: The `Event` for which to create the abstract form.
:param user: The user who is going to use the form.
:param notification_option: Whether to add a field to the form to
... | make_abstract_form | python | indico/indico | indico/modules/events/abstracts/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/util.py | MIT |
def get_user_abstracts(event, user):
"""Get the list of abstracts where the user is a reviewer/convener."""
return (Abstract.query.with_parent(event)
.options(joinedload('reviews'),
joinedload('person_links'))
.filter(db.or_(Abstract.submitter == user,
... | Get the list of abstracts where the user is a reviewer/convener. | get_user_abstracts | python | indico/indico | indico/modules/events/abstracts/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/util.py | MIT |
def get_user_tracks(event, user):
"""Get the list of tracks where the user is a reviewer/convener."""
tracks = Track.query.with_parent(event).order_by(Track.title).all()
if (event.can_manage(user, permission='review_all_abstracts', explicit_permission=True) or
event.can_manage(user, permission='... | Get the list of tracks where the user is a reviewer/convener. | get_user_tracks | python | indico/indico | indico/modules/events/abstracts/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/util.py | MIT |
def get_track_reviewer_abstract_counts(event, user):
"""Get the numbers of abstracts per track for a specific user.
Note that this does not take into account if the user is a
reviewer for a track; it just checks whether the user has
reviewed an abstract in a track or not.
:return: A dict mapping t... | Get the numbers of abstracts per track for a specific user.
Note that this does not take into account if the user is a
reviewer for a track; it just checks whether the user has
reviewed an abstract in a track or not.
:return: A dict mapping tracks to dicts containing the counts.
| get_track_reviewer_abstract_counts | python | indico/indico | indico/modules/events/abstracts/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/util.py | MIT |
def create_boa(event):
"""Create the book of abstracts if necessary.
:return: The path to the PDF file
"""
path = boa_settings.get(event, 'cache_path')
if path:
path = os.path.join(config.CACHE_DIR, path)
if os.path.exists(path):
# update file mtime so it's not deleted d... | Create the book of abstracts if necessary.
:return: The path to the PDF file
| create_boa | python | indico/indico | indico/modules/events/abstracts/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/util.py | MIT |
def create_boa_tex(event):
"""Create the book of abstracts as a LaTeX archive.
:return: A `BytesIO` containing the zip file.
"""
with force_locale(config.DEFAULT_LOCALE):
tex = AbstractBook(event)
return tex.generate_source_archive() | Create the book of abstracts as a LaTeX archive.
:return: A `BytesIO` containing the zip file.
| create_boa_tex | python | indico/indico | indico/modules/events/abstracts/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/util.py | MIT |
def clear_boa_cache(event):
"""Delete the cached book of abstract."""
path = boa_settings.get(event, 'cache_path')
if path:
try:
os.remove(os.path.join(config.CACHE_DIR, path))
except OSError as e:
if e.errno != errno.ENOENT:
raise
boa_settings... | Delete the cached book of abstract. | clear_boa_cache | python | indico/indico | indico/modules/events/abstracts/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/util.py | MIT |
def get_events_with_abstract_reviewer_convener(user, dt=None):
"""
Return a dict of event ids and the abstract reviewing related
roles the user has in that event.
:param user: A `User`
:param dt: Only include events taking place on/after that date
"""
data = defaultdict(set)
# global re... |
Return a dict of event ids and the abstract reviewing related
roles the user has in that event.
:param user: A `User`
:param dt: Only include events taking place on/after that date
| get_events_with_abstract_reviewer_convener | python | indico/indico | indico/modules/events/abstracts/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/util.py | MIT |
def get_events_with_abstract_persons(user, dt=None):
"""
Return a dict of event ids and the abstract submission related
roles the user has in that event.
:param user: A `User`
:param dt: Only include events taking place on/after that date
"""
data = defaultdict(set)
bad_states = {Abstra... |
Return a dict of event ids and the abstract submission related
roles the user has in that event.
:param user: A `User`
:param dt: Only include events taking place on/after that date
| get_events_with_abstract_persons | python | indico/indico | indico/modules/events/abstracts/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/util.py | MIT |
def create_from_email(cls, email_data, email_tpl, user=None):
"""Create a new log entry from the data used to send an email.
:param email_data: email data as returned from `make_email`
:param email_tpl: the abstract email template that created the
email
:param ... | Create a new log entry from the data used to send an email.
:param email_data: email data as returned from `make_email`
:param email_tpl: the abstract email template that created the
email
:param user: the user who performed the action causing the
... | create_from_email | python | indico/indico | indico/modules/events/abstracts/models/email_logs.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/models/email_logs.py | MIT |
def _get_next_position(context):
"""Get the next email template position for the event."""
event_id = context.current_parameters['event_id']
res = (db.session.query(db.func.max(AbstractEmailTemplate.position))
.filter(AbstractEmailTemplate.event_id == event_id)
.one())
return (res[... | Get the next email template position for the event. | _get_next_position | python | indico/indico | indico/modules/events/abstracts/models/email_templates.py | https://github.com/indico/indico/blob/master/indico/modules/events/abstracts/models/email_templates.py | MIT |
def extend_api_data(cls, event, person, agreement, data): # pragma: no cover
"""Extend the data returned in the HTTP API.
:param event: the event
:param person: the :class:`AgreementPersonInfo`
:param agreement: the :class:`Agreement` if available
:param data: a dict containing... | Extend the data returned in the HTTP API.
:param event: the event
:param person: the :class:`AgreementPersonInfo`
:param agreement: the :class:`Agreement` if available
:param data: a dict containing the default data for the agreement
| extend_api_data | python | indico/indico | indico/modules/events/agreements/base.py | https://github.com/indico/indico/blob/master/indico/modules/events/agreements/base.py | MIT |
def get_email_body_template(cls, event, **kwargs):
"""Return the template of the email body for this agreement definition."""
template_name = cls.email_body_template_name or 'emails/agreement_default_body.html'
template_path = get_overridable_template_name(template_name, cls.plugin, 'events/agre... | Return the template of the email body for this agreement definition. | get_email_body_template | python | indico/indico | indico/modules/events/agreements/base.py | https://github.com/indico/indico/blob/master/indico/modules/events/agreements/base.py | MIT |
def get_people(cls, event):
"""Return a dictionary of :class:`AgreementPersonInfo` required to sign agreements."""
people = cls.iter_people(event)
if people is None:
return {}
return {p.identifier: p for p in people} | Return a dictionary of :class:`AgreementPersonInfo` required to sign agreements. | get_people | python | indico/indico | indico/modules/events/agreements/base.py | https://github.com/indico/indico/blob/master/indico/modules/events/agreements/base.py | MIT |
def get_people_not_notified(cls, event):
"""Return a dictionary of :class:`AgreementPersonInfo` yet to be notified."""
people = cls.get_people(event)
sent_agreements = {a.identifier for a in event.agreements.filter_by(type=cls.name)}
return {k: v for k, v in people.items() if v.identifie... | Return a dictionary of :class:`AgreementPersonInfo` yet to be notified. | get_people_not_notified | python | indico/indico | indico/modules/events/agreements/base.py | https://github.com/indico/indico/blob/master/indico/modules/events/agreements/base.py | MIT |
def get_stats_for_signed_agreements(cls, event):
"""Return a digest of signed agreements on an event.
:param event: the event
:return: (everybody_signed, num_accepted, num_rejected)
"""
people = cls.get_people(event)
identifiers = [p.identifier for p in people.values()]
... | Return a digest of signed agreements on an event.
:param event: the event
:return: (everybody_signed, num_accepted, num_rejected)
| get_stats_for_signed_agreements | python | indico/indico | indico/modules/events/agreements/base.py | https://github.com/indico/indico/blob/master/indico/modules/events/agreements/base.py | MIT |
def send_new_agreements(event, name, people, email_body, cc_addresses, sender_address):
"""Create and send agreements for a list of people on a given event.
:param event: The `Event` associated with the agreement
:param name: The agreement type matcing a :class:`AgreementDefinition` name
:param people:... | Create and send agreements for a list of people on a given event.
:param event: The `Event` associated with the agreement
:param name: The agreement type matcing a :class:`AgreementDefinition` name
:param people: The list of people for whom agreements will be created
:param email_body: The body of the ... | send_new_agreements | python | indico/indico | indico/modules/events/agreements/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/agreements/util.py | MIT |
def create_person():
"""Return a callable which lets you create AgreementPersonInfo."""
def _create_person(name, email, data=None):
return AgreementPersonInfo(name=name, email=email, data=data)
return _create_person | Return a callable which lets you create AgreementPersonInfo. | create_person | python | indico/indico | indico/modules/events/agreements/testing/fixtures.py | https://github.com/indico/indico/blob/master/indico/modules/events/agreements/testing/fixtures.py | MIT |
def create_agreement(db, dummy_event, dummy_person):
"""Return a a callable which lets you create agreements."""
def _create_agreement(state):
agreement = Agreement(uuid=str(uuid4()), event=dummy_event, type='dummy',
person_email=dummy_person.email, person_name=dummy_perso... | Return a a callable which lets you create agreements. | create_agreement | python | indico/indico | indico/modules/events/agreements/testing/fixtures.py | https://github.com/indico/indico/blob/master/indico/modules/events/agreements/testing/fixtures.py | MIT |
def clone_single_contribution(cls, contribution, preserve_session=False):
"""Clone a single contribution within the same event.
:param contribution: The `Contribution` to clone
:param preserve_session: Whether to assign and schedule
:return: The newly created contribution
"""
... | Clone a single contribution within the same event.
:param contribution: The `Contribution` to clone
:param preserve_session: Whether to assign and schedule
:return: The newly created contribution
| clone_single_contribution | python | indico/indico | indico/modules/events/contributions/clone.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/clone.py | MIT |
def generate_contribution_component(contribution, related_to_uid=None, organizer=None):
"""Generate an Event icalendar component from an Indico Contribution.
:param contribution: The Indico Contribution to use
:param related_to_uid: Indico uid used in RELATED-TO field
:return: an icalendar Event
""... | Generate an Event icalendar component from an Indico Contribution.
:param contribution: The Indico Contribution to use
:param related_to_uid: Indico uid used in RELATED-TO field
:return: an icalendar Event
| generate_contribution_component | python | indico/indico | indico/modules/events/contributions/ical.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/ical.py | MIT |
def contribution_to_ical(contribution):
"""Serialize a contribution into an ical.
:param contribution: The contribution to serialize
"""
calendar = icalendar.Calendar()
calendar.add('version', '2.0')
calendar.add('prodid', '-//CERN//INDICO//EN')
related_event_uid = contribution.event.ical_... | Serialize a contribution into an ical.
:param contribution: The contribution to serialize
| contribution_to_ical | python | indico/indico | indico/modules/events/contributions/ical.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/ical.py | MIT |
def render_list(self, contrib=None):
"""Render the contribution list template components.
:param contrib: Used in RHs responsible for CRUD operations on a
contribution.
:return: dict containing the list's entries, the fragment of
displayed entries and wh... | Render the contribution list template components.
:param contrib: Used in RHs responsible for CRUD operations on a
contribution.
:return: dict containing the list's entries, the fragment of
displayed entries and whether the contribution passed is
... | render_list | python | indico/indico | indico/modules/events/contributions/lists.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/lists.py | MIT |
def render_contribution_list(self):
"""Render the contribution list template components.
:return: dict containing the list's entries, the fragment of
displayed entries and whether the contribution passed is displayed
in the results.
"""
contrib_list_kwa... | Render the contribution list template components.
:return: dict containing the list's entries, the fragment of
displayed entries and whether the contribution passed is displayed
in the results.
| render_contribution_list | python | indico/indico | indico/modules/events/contributions/lists.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/lists.py | MIT |
def _ensure_consistency(contrib):
"""Unschedule contribution if not consistent with timetable.
A contribution that has no session assigned, may not be scheduled
inside a session. A contribution that has a session assigned may
only be scheduled inside a session block associated with that
session, a... | Unschedule contribution if not consistent with timetable.
A contribution that has no session assigned, may not be scheduled
inside a session. A contribution that has a session assigned may
only be scheduled inside a session block associated with that
session, and that session block must match the sess... | _ensure_consistency | python | indico/indico | indico/modules/events/contributions/operations.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/operations.py | MIT |
def update_contribution(contrib: Contribution, contrib_data: dict, custom_fields_data=None):
"""Update a contribution.
:param contrib: The `Contribution` to update
:param contrib_data: A dict containing the data to update
:param custom_fields_data: A dict containing the data for custom
... | Update a contribution.
:param contrib: The `Contribution` to update
:param contrib_data: A dict containing the data to update
:param custom_fields_data: A dict containing the data for custom
fields.
:return: A dictionary containing information related to the
... | update_contribution | python | indico/indico | indico/modules/events/contributions/operations.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/operations.py | MIT |
def get_events_with_linked_contributions(user, dt=None):
"""
Return a dict with keys representing event_id and the values containing
data about the user rights for contributions within the event.
:param user: A `User`
:param dt: Only include events taking place on/after that date
"""
def ad... |
Return a dict with keys representing event_id and the values containing
data about the user rights for contributions within the event.
:param user: A `User`
:param dt: Only include events taking place on/after that date
| get_events_with_linked_contributions | python | indico/indico | indico/modules/events/contributions/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/util.py | MIT |
def generate_spreadsheet_from_contributions(contributions):
"""
Return a tuple consisting of spreadsheet columns and respective
contribution values.
"""
has_board_number = any(c.board_number for c in contributions)
has_authors = any(pl.author_type != AuthorType.none for c in contributions for pl... |
Return a tuple consisting of spreadsheet columns and respective
contribution values.
| generate_spreadsheet_from_contributions | python | indico/indico | indico/modules/events/contributions/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/util.py | MIT |
def make_contribution_form(event, *, contrib=None, management=True, only_custom_fields=False):
"""Extend the contribution WTForm to add the extra fields.
Each extra field will use a field named ``custom_ID`` (except `keywords`).
:param event: The `Event` for which to create the contribution form.
:ret... | Extend the contribution WTForm to add the extra fields.
Each extra field will use a field named ``custom_ID`` (except `keywords`).
:param event: The `Event` for which to create the contribution form.
:return: A `ContributionForm` subclass.
| make_contribution_form | python | indico/indico | indico/modules/events/contributions/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/util.py | MIT |
def get_contributions_with_user_as_submitter(event, user):
"""Get a list of contributions in which the `user` has submission rights."""
return (_query_contributions_with_user_as_submitter(event, user)
.options(joinedload('acl_entries'))
.order_by(db.func.lower(Contribution.title))
... | Get a list of contributions in which the `user` has submission rights. | get_contributions_with_user_as_submitter | python | indico/indico | indico/modules/events/contributions/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/util.py | MIT |
def get_contributions_for_person(event, person, only_speakers=False):
"""Get all contributions for an event person.
If ``only_speakers`` is true, then only contributions where the person is a
speaker are returned
"""
cl_join = db.and_(ContributionPersonLink.person_id == person.id,
... | Get all contributions for an event person.
If ``only_speakers`` is true, then only contributions where the person is a
speaker are returned
| get_contributions_for_person | python | indico/indico | indico/modules/events/contributions/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/util.py | MIT |
def import_contributions_from_csv(event, f, delimiter=','):
"""Import timetable contributions from a CSV file into an event."""
with csv_text_io_wrapper(f) as ftxt:
reader = csv.reader(ftxt.read().splitlines(), delimiter=delimiter)
contrib_data = []
for num_row, row in enumerate(reader, 1):
... | Import timetable contributions from a CSV file into an event. | import_contributions_from_csv | python | indico/indico | indico/modules/events/contributions/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/util.py | MIT |
def _get_persons(event, condition):
"""
Query event persons linked to contributions in the event,
filtered using the condition provided.
"""
return (event.persons.filter(EventPerson.contribution_links.any(
db.and_(condition,
ContributionPersonLink.contribution.has(~Co... |
Query event persons linked to contributions in the event,
filtered using the condition provided.
| _get_persons | python | indico/indico | indico/modules/events/contributions/controllers/display.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/controllers/display.py | MIT |
def _get_next_friendly_id(context):
"""Get the next friendly id for a contribution."""
from indico.modules.events import Event
event_id = context.current_parameters['event_id']
# Check first if there is a pre-allocated friendly id
# (and use it in that case)
friendly_ids = g.get('friendly_ids',... | Get the next friendly id for a contribution. | _get_next_friendly_id | python | indico/indico | indico/modules/events/contributions/models/contributions.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/models/contributions.py | MIT |
def allocate_friendly_ids(cls, event, n):
"""Allocate n Contribution friendly_ids.
This is needed so that we can allocate all IDs in one go. Not doing
so could result in DB deadlocks. All operations that create more than
one contribution should use this method.
:param event: th... | Allocate n Contribution friendly_ids.
This is needed so that we can allocate all IDs in one go. Not doing
so could result in DB deadlocks. All operations that create more than
one contribution should use this method.
:param event: the :class:`Event` in question
:param n: the nu... | allocate_friendly_ids | python | indico/indico | indico/modules/events/contributions/models/contributions.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/models/contributions.py | MIT |
def _get_next_position(context):
"""Get the next contribution field position for the event."""
event_id = context.current_parameters['event_id']
res = db.session.query(db.func.max(ContributionField.position)).filter(ContributionField.event_id == event_id).one()
return (res[0] or 0) + 1 | Get the next contribution field position for the event. | _get_next_position | python | indico/indico | indico/modules/events/contributions/models/fields.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/models/fields.py | MIT |
def _get_next_friendly_id(context):
"""Get the next friendly id for a sub-contribution."""
from indico.modules.events.contributions.models.contributions import Contribution
contribution_id = context.current_parameters['contribution_id']
assert contribution_id is not None
return increment_and_get(Con... | Get the next friendly id for a sub-contribution. | _get_next_friendly_id | python | indico/indico | indico/modules/events/contributions/models/subcontributions.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/models/subcontributions.py | MIT |
def _get_next_position(context):
"""Get the next menu entry position for the event."""
contribution_id = context.current_parameters['contribution_id']
res = (db.session.query(db.func.max(SubContribution.position))
.filter(SubContribution.contribution_id == contribution_id)
.one())
... | Get the next menu entry position for the event. | _get_next_position | python | indico/indico | indico/modules/events/contributions/models/subcontributions.py | https://github.com/indico/indico/blob/master/indico/modules/events/contributions/models/subcontributions.py | MIT |
def test_event_public_access(db, create_event):
"""Ensure if a null user can access a public event."""
rh = RHProtectedEventBase()
rh.event = create_event(1, protection_mode=ProtectionMode.public)
rh._check_access() | Ensure if a null user can access a public event. | test_event_public_access | python | indico/indico | indico/modules/events/controllers/base_test.py | https://github.com/indico/indico/blob/master/indico/modules/events/controllers/base_test.py | MIT |
def test_event_protected_access(db, create_user, create_event):
"""
Ensure a null user cannot access a protected event. Ensure a user
with respective ACL entry can access a protected event.
"""
rh = RHProtectedEventBase()
rh.event = create_event(2, protection_mode=ProtectionMode.protected)
w... |
Ensure a null user cannot access a protected event. Ensure a user
with respective ACL entry can access a protected event.
| test_event_protected_access | python | indico/indico | indico/modules/events/controllers/base_test.py | https://github.com/indico/indico/blob/master/indico/modules/events/controllers/base_test.py | MIT |
def test_event_key_access(create_user, create_event):
"""Ensure the event doesn't reject the user if an access key is required."""
rh = RHDisplayEventBase()
rh.event = create_event(2, protection_mode=ProtectionMode.protected, access_key='abc')
with pytest.raises(AccessKeyRequired):
rh._check_acc... | Ensure the event doesn't reject the user if an access key is required. | test_event_key_access | python | indico/indico | indico/modules/events/controllers/base_test.py | https://github.com/indico/indico/blob/master/indico/modules/events/controllers/base_test.py | MIT |
def notify_comment(comment):
"""Notify about a new comments on a revision."""
revision = comment.revision
editable = revision.editable
editor = editable.editor
submitter = next((r.user for r in editable.revisions[::-1] if r.is_submitter_revision), None)
author = comment.user
if comment.inter... | Notify about a new comments on a revision. | notify_comment | python | indico/indico | indico/modules/events/editing/notifications.py | https://github.com/indico/indico/blob/master/indico/modules/events/editing/notifications.py | MIT |
def get_editors(event, editable_type):
"""Get all users who are editors in the event.
Other principal types are automatically resolved to the actual users
contained in them.
"""
users = set()
for principal in event.acl_entries:
if not principal.has_management_permission(editable_type.ed... | Get all users who are editors in the event.
Other principal types are automatically resolved to the actual users
contained in them.
| get_editors | python | indico/indico | indico/modules/events/editing/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/editing/util.py | MIT |
def _has_general_editor_permissions(self, user):
"""Whether the user has general editor permissions on the Editable.
This means that the user has editor permissions for the editable's type,
but does not need to be the assigned editor.
"""
# Editing (and event) managers always ha... | Whether the user has general editor permissions on the Editable.
This means that the user has editor permissions for the editable's type,
but does not need to be the assigned editor.
| _has_general_editor_permissions | python | indico/indico | indico/modules/events/editing/models/editable.py | https://github.com/indico/indico/blob/master/indico/modules/events/editing/models/editable.py | MIT |
def can_see_timeline(self, user):
"""Whether the user can see the editable's timeline.
This is pure read access, without any ability to make changes
or leave comments.
"""
# Anyone with editor access to the editable's type can see the timeline.
# Users associated with th... | Whether the user can see the editable's timeline.
This is pure read access, without any ability to make changes
or leave comments.
| can_see_timeline | python | indico/indico | indico/modules/events/editing/models/editable.py | https://github.com/indico/indico/blob/master/indico/modules/events/editing/models/editable.py | MIT |
def can_perform_editor_actions(self, user):
"""Whether the user can perform any Editing actions.
These are actions usually made by the assigned Editor of the
editable, such as making changes, asking the user to make changes,
or approving/rejecting the editable.
"""
from ... | Whether the user can perform any Editing actions.
These are actions usually made by the assigned Editor of the
editable, such as making changes, asking the user to make changes,
or approving/rejecting the editable.
| can_perform_editor_actions | python | indico/indico | indico/modules/events/editing/models/editable.py | https://github.com/indico/indico/blob/master/indico/modules/events/editing/models/editable.py | MIT |
def can_comment(self, user):
"""Whether the user can comment on the editable."""
# We allow any user associated with the contribution to comment, even if they are
# not authorized to actually perform submitter actions.
return (self.event.can_manage(user, permission=self.type.editor_permi... | Whether the user can comment on the editable. | can_comment | python | indico/indico | indico/modules/events/editing/models/editable.py | https://github.com/indico/indico/blob/master/indico/modules/events/editing/models/editable.py | MIT |
def can_assign_self(self, user):
"""Whether the user can assign themselves on the editable."""
from indico.modules.events.editing.settings import editable_type_settings
type_settings = editable_type_settings[self.type]
if self.editor and (self.editor == user or not self.can_unassign(user... | Whether the user can assign themselves on the editable. | can_assign_self | python | indico/indico | indico/modules/events/editing/models/editable.py | https://github.com/indico/indico/blob/master/indico/modules/events/editing/models/editable.py | MIT |
def can_unassign(self, user):
"""Whether the user can unassign the editor of the editable."""
from indico.modules.events.editing.settings import editable_type_settings
type_settings = editable_type_settings[self.type]
return (self.event.can_manage(user, permission='editing_manager')
... | Whether the user can unassign the editor of the editable. | can_unassign | python | indico/indico | indico/modules/events/editing/models/editable.py | https://github.com/indico/indico/blob/master/indico/modules/events/editing/models/editable.py | MIT |
def get_published_files(self):
"""Get the published files, grouped by file type."""
files = defaultdict(list)
for file in self.files:
if file.file_type.publishable:
files[file.file_type].append(file)
return dict(files) | Get the published files, grouped by file type. | get_published_files | python | indico/indico | indico/modules/events/editing/models/revisions.py | https://github.com/indico/indico/blob/master/indico/modules/events/editing/models/revisions.py | MIT |
def requires_deep(cls):
"""All feature names required by this feature.
This includes features required by a requirement.
"""
feature_definitions = get_feature_definitions()
todo = set(cls.requires)
features = set()
while todo:
feature = todo.pop()
... | All feature names required by this feature.
This includes features required by a requirement.
| requires_deep | python | indico/indico | indico/modules/events/features/base.py | https://github.com/indico/indico/blob/master/indico/modules/events/features/base.py | MIT |
def required_by_deep(cls):
"""All feature names depending on this feature.
This includes features which depend on a feature depending on
this feature.
"""
# This is not very efficient, but it runs exactly one on a not-very-large set
return {feature.name for feature in ge... | All feature names depending on this feature.
This includes features which depend on a feature depending on
this feature.
| required_by_deep | python | indico/indico | indico/modules/events/features/base.py | https://github.com/indico/indico/blob/master/indico/modules/events/features/base.py | MIT |
def get_enabled_features(event, only_explicit=False):
"""Return a set of enabled feature names for an event."""
enabled_features = features_event_settings.get(event, 'enabled')
if enabled_features is not None:
return set(enabled_features)
elif only_explicit:
return set()
else:
... | Return a set of enabled feature names for an event. | get_enabled_features | python | indico/indico | indico/modules/events/features/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/features/util.py | MIT |
def set_feature_enabled(event, name, state):
"""Enable/disable a feature for an event.
:param event: The event.
:param name: The name of the feature.
:param state: If the feature is enabled or not.
:return: Boolean indicating if the state of the feature changed.
"""
feature_definitions = ge... | Enable/disable a feature for an event.
:param event: The event.
:param name: The name of the feature.
:param state: If the feature is enabled or not.
:return: Boolean indicating if the state of the feature changed.
| set_feature_enabled | python | indico/indico | indico/modules/events/features/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/features/util.py | MIT |
def get_disallowed_features(event):
"""
Get a set containing the names of features which are not available
for an event.
"""
disallowed = {feature
for feature in get_feature_definitions().values()
if not feature.is_allowed_for_event(event)}
indirectly_disallow... |
Get a set containing the names of features which are not available
for an event.
| get_disallowed_features | python | indico/indico | indico/modules/events/features/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/features/util.py | MIT |
def is_feature_enabled(event, name):
"""Check if a feature is enabled for an event.
:param event: The event (or event ID) to check.
:param name: The name of the feature.
"""
feature = get_feature_definition(name)
enabled_features = features_event_settings.get(event, 'enabled')
if enabled_fe... | Check if a feature is enabled for an event.
:param event: The event (or event ID) to check.
:param name: The name of the feature.
| is_feature_enabled | python | indico/indico | indico/modules/events/features/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/features/util.py | MIT |
def require_feature(event, name):
"""Raise a NotFound error if a feature is not enabled.
:param event: The event (or event ID) to check.
:param name: The name of the feature.
"""
if not is_feature_enabled(event, name):
feature = get_feature_definition(name)
raise NotFound(_("The '{f... | Raise a NotFound error if a feature is not enabled.
:param event: The event (or event ID) to check.
:param name: The name of the feature.
| require_feature | python | indico/indico | indico/modules/events/features/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/features/util.py | MIT |
def build_menu_entry_name(name, plugin=None):
"""Build the proper name for a menu entry.
Given a menu entry's name and optionally a plugin, returns the
correct name of the menu entry.
:param name: str -- The name of the menu entry.
:param plugin: IndicoPlugin or str -- The plugin (or the name of t... | Build the proper name for a menu entry.
Given a menu entry's name and optionally a plugin, returns the
correct name of the menu entry.
:param name: str -- The name of the menu entry.
:param plugin: IndicoPlugin or str -- The plugin (or the name of the
plugin) which created the entry.
| build_menu_entry_name | python | indico/indico | indico/modules/events/layout/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/layout/util.py | MIT |
def _get_split_signal_entries():
"""Get the top-level and child menu entry data."""
signal_entries = get_menu_entries_from_signal()
top_data = {name: data
for name, data in sorted(signal_entries.items(),
key=lambda name_data: _menu_entry_key(name_data... | Get the top-level and child menu entry data. | _get_split_signal_entries | python | indico/indico | indico/modules/events/layout/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/layout/util.py | MIT |
def _menu_needs_recheck(event):
"""Check whether the menu needs to be checked for missing items."""
cache_key, cache_version = _get_menu_cache_data(event)
return _cache.get(cache_key) != cache_version | Check whether the menu needs to be checked for missing items. | _menu_needs_recheck | python | indico/indico | indico/modules/events/layout/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/layout/util.py | MIT |
def _save_menu_entries(entries):
"""Save new menu entries using a separate SA session."""
with db.tmp_session() as sess:
sess.add_all(entries)
try:
sess.commit()
except IntegrityError as exc:
# If there are two parallel requests trying to insert a new menu
... | Save new menu entries using a separate SA session. | _save_menu_entries | python | indico/indico | indico/modules/events/layout/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/layout/util.py | MIT |
def _rebuild_menu(event):
"""Create all menu entries in the database."""
top_data, child_data = _get_split_signal_entries()
pos_gen = count()
entries = [_build_menu_entry(event, True, data, next(pos_gen), children=child_data.get(data.name))
for name, data in top_data.items()]
return _... | Create all menu entries in the database. | _rebuild_menu | python | indico/indico | indico/modules/events/layout/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/layout/util.py | MIT |
def _check_menu(event):
"""Create missing menu items in the database."""
top_data, child_data = _get_split_signal_entries()
query = (MenuEntry.query
.filter(MenuEntry.event_id == int(event.id))
.options(load_only('id', 'parent_id', 'name', 'position'),
joined... | Create missing menu items in the database. | _check_menu | python | indico/indico | indico/modules/events/layout/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/layout/util.py | MIT |
def _build_menu(event):
"""Fetch the customizable menu data from the database."""
entries = MenuEntry.get_for_event(event)
if not entries:
# empty menu, just build the whole structure without checking
# for existing menu entries
if _rebuild_menu(event):
_set_menu_checked(... | Fetch the customizable menu data from the database. | _build_menu | python | indico/indico | indico/modules/events/layout/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/layout/util.py | MIT |
def _build_transient_menu(event):
"""Build the transient event menu from the signal data.
This is used to check for missing items if customization is
enabled or for the actual menu if no customization is used
"""
top_data, child_data = _get_split_signal_entries()
pos_gen = count()
return [_... | Build the transient event menu from the signal data.
This is used to check for missing items if customization is
enabled or for the actual menu if no customization is used
| _build_transient_menu | python | indico/indico | indico/modules/events/layout/util.py | https://github.com/indico/indico/blob/master/indico/modules/events/layout/util.py | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.