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 _processTOCPage(self):
"""Generates page with table of contents.
Not used, because table of contents is generated automatically inside DocTemplateWithTOC class.
"""
style1 = ParagraphStyle({})
style1.fontName = 'Times-Bold'
style1.fontSize = modifiedFontSize(18, self... | Generates page with table of contents.
Not used, because table of contents is generated automatically inside DocTemplateWithTOC class.
| _processTOCPage | python | indico/indico | indico/legacy/pdfinterface/base.py | https://github.com/indico/indico/blob/master/indico/legacy/pdfinterface/base.py | MIT |
def getBody(self, story=None):
"""Add the content to the story.
When you want to put a paragraph p in the toc, add it to the self._indexedFlowable as this:
self._indexedFlowable[p] = {'text':'my title', 'level':1}.
"""
if not story:
story = self._story | Add the content to the story.
When you want to put a paragraph p in the toc, add it to the self._indexedFlowable as this:
self._indexedFlowable[p] = {'text':'my title', 'level':1}.
| getBody | python | indico/indico | indico/legacy/pdfinterface/base.py | https://github.com/indico/indico/blob/master/indico/legacy/pdfinterface/base.py | MIT |
def _upgrade_access_data():
"""
Upgrade the access column to protection_mode, speakers_can_access, and the principals.
Here is the mapping:
access || protection_mode | speakers_can_access | menu_entry_principals
========================++=================+==================... |
Upgrade the access column to protection_mode, speakers_can_access, and the principals.
Here is the mapping:
access || protection_mode | speakers_can_access | menu_entry_principals
========================++=================+=====================+===========================
... | _upgrade_access_data | python | indico/indico | indico/migrations/versions/20230802_1500_e47fc6634291_add_menu_entry_acls.py | https://github.com/indico/indico/blob/master/indico/migrations/versions/20230802_1500_e47fc6634291_add_menu_entry_acls.py | MIT |
def _downgrade_access_data():
"""
Downgrade the protection_mode, speakers_can_access and principals to the access column. This isn't
lossless given the new feature is more fine-grained, but best effort.
Here is the mapping:
protection_mode | speakers_can_access | menu_entry_principals || ... |
Downgrade the protection_mode, speakers_can_access and principals to the access column. This isn't
lossless given the new feature is more fine-grained, but best effort.
Here is the mapping:
protection_mode | speakers_can_access | menu_entry_principals || access
=================+====... | _downgrade_access_data | python | indico/indico | indico/migrations/versions/20230802_1500_e47fc6634291_add_menu_entry_acls.py | https://github.com/indico/indico/blob/master/indico/migrations/versions/20230802_1500_e47fc6634291_add_menu_entry_acls.py | MIT |
def _ignore_non_loggable(f):
"""
Only call the decorated function if the attachment/folder change
should be logged.
"""
@wraps(f)
def wrapper(sender, **kwargs):
if not kwargs.get('internal'):
f(sender, **kwargs)
return wrapper |
Only call the decorated function if the attachment/folder change
should be logged.
| _ignore_non_loggable | python | indico/indico | indico/modules/attachments/logging.py | https://github.com/indico/indico/blob/master/indico/modules/attachments/logging.py | MIT |
def get_file_previewer(attachment_file):
"""
Return a file previewer for the given attachment file based on the
file's content type.
"""
for previewer in get_file_previewers():
if previewer.can_preview(attachment_file):
return previewer() |
Return a file previewer for the given attachment file based on the
file's content type.
| get_file_previewer | python | indico/indico | indico/modules/attachments/preview.py | https://github.com/indico/indico/blob/master/indico/modules/attachments/preview.py | MIT |
def get_attached_folders(linked_object, include_empty=True, include_hidden=True, preload_event=False):
"""Return a list of all the folders linked to an object.
:param linked_object: The object whose attachments are to be returned
:param include_empty: Whether to return empty folders as well.
:param inc... | Return a list of all the folders linked to an object.
:param linked_object: The object whose attachments are to be returned
:param include_empty: Whether to return empty folders as well.
:param include_hidden: Include folders that the user can't see
:param preload_event: in the process, preload all obj... | get_attached_folders | python | indico/indico | indico/modules/attachments/util.py | https://github.com/indico/indico/blob/master/indico/modules/attachments/util.py | MIT |
def get_attached_items(linked_object, include_empty=True, include_hidden=True, preload_event=False):
"""
Return a structured representation of all the attachments linked
to an object.
:param linked_object: The object whose attachments are to be returned
:param include_empty: Whether to return empty... |
Return a structured representation of all the attachments linked
to an object.
:param linked_object: The object whose attachments are to be returned
:param include_empty: Whether to return empty folders as well.
:param include_hidden: Include folders that the user can't see
:param preload_even... | get_attached_items | python | indico/indico | indico/modules/attachments/util.py | https://github.com/indico/indico/blob/master/indico/modules/attachments/util.py | MIT |
def can_manage_attachments(obj, user, allow_admin=True):
"""Check if a user can manage attachments for the object."""
from indico.modules.attachments.settings import attachments_settings
if not user:
return False
if obj.can_manage(user, allow_admin=allow_admin):
return True
event = g... | Check if a user can manage attachments for the object. | can_manage_attachments | python | indico/indico | indico/modules/attachments/util.py | https://github.com/indico/indico/blob/master/indico/modules/attachments/util.py | MIT |
def get_download_url(self, absolute=False):
"""Return the download url for the attachment.
During static site generation this returns a local URL for the
file or the target URL for the link.
:param absolute: If the returned URL should be absolute.
"""
if g.get('static_s... | Return the download url for the attachment.
During static site generation this returns a local URL for the
file or the target URL for the link.
:param absolute: If the returned URL should be absolute.
| get_download_url | python | indico/indico | indico/modules/attachments/models/attachments.py | https://github.com/indico/indico/blob/master/indico/modules/attachments/models/attachments.py | MIT |
def can_access(self, user, *args, **kwargs):
"""Check if the user is allowed to access the attachment.
This is the case if the user has access to see the attachment
or if the user can manage attachments for the linked object.
"""
return (super().can_access(user, *args, **kwargs)... | Check if the user is allowed to access the attachment.
This is the case if the user has access to see the attachment
or if the user can manage attachments for the linked object.
| can_access | python | indico/indico | indico/modules/attachments/models/attachments.py | https://github.com/indico/indico/blob/master/indico/modules/attachments/models/attachments.py | MIT |
def get_or_create_default(cls, linked_object):
"""Get the default folder for the given object or creates it."""
folder = cls.query.filter_by(is_default=True, object=linked_object).first()
if folder is None:
folder = cls(is_default=True, object=linked_object)
return folder | Get the default folder for the given object or creates it. | get_or_create_default | python | indico/indico | indico/modules/attachments/models/folders.py | https://github.com/indico/indico/blob/master/indico/modules/attachments/models/folders.py | MIT |
def get_or_create(cls, linked_object, title=None, **create_kwargs):
"""Get a folder for the given object or create it.
If no folder title is specified, the default folder will be
used. It is the caller's responsibility to add the folder
or an object (such as an attachment) associated w... | Get a folder for the given object or create it.
If no folder title is specified, the default folder will be
used. It is the caller's responsibility to add the folder
or an object (such as an attachment) associated with it
to the SQLAlchemy session using ``db.session.add(...)``.
... | get_or_create | python | indico/indico | indico/modules/attachments/models/folders.py | https://github.com/indico/indico/blob/master/indico/modules/attachments/models/folders.py | MIT |
def can_access(self, user, *args, **kwargs):
"""Check if the user is allowed to access the folder.
This is the case if the user has access the folder or if the
user can manage attachments for the linked object.
"""
return (super().can_access(user, *args, **kwargs) or
... | Check if the user is allowed to access the folder.
This is the case if the user has access the folder or if the
user can manage attachments for the linked object.
| can_access | python | indico/indico | indico/modules/attachments/models/folders.py | https://github.com/indico/indico/blob/master/indico/modules/attachments/models/folders.py | MIT |
def can_view(self, user):
"""Check if the user can see the folder.
This does not mean the user can actually access its contents.
It just determines if it is visible to him or not.
"""
if self.is_hidden:
return False
if not self.object.can_access(user):
... | Check if the user can see the folder.
This does not mean the user can actually access its contents.
It just determines if it is visible to him or not.
| can_view | python | indico/indico | indico/modules/attachments/models/folders.py | https://github.com/indico/indico/blob/master/indico/modules/attachments/models/folders.py | MIT |
def get_for_linked_object(cls, linked_object, preload_event=False):
"""Get the attachments for the given object.
This only returns attachments that haven't been deleted.
:param linked_object: A category, event, session, contribution or
subcontribution.
:pa... | Get the attachments for the given object.
This only returns attachments that haven't been deleted.
:param linked_object: A category, event, session, contribution or
subcontribution.
:param preload_event: If all attachments for the same event should
... | get_for_linked_object | python | indico/indico | indico/modules/attachments/models/folders.py | https://github.com/indico/indico/blob/master/indico/modules/attachments/models/folders.py | MIT |
def test_process_identity_sets_hard_expiry(app):
"""Test that hard expiry is set on the session object if it is present in the multipass data."""
dt_now = datetime.now(UTC)
identity_info = IdentityInfo(
provider=StaticIdentityProvider(
multipass=Multipass(), name='static', settings={}
... | Test that hard expiry is set on the session object if it is present in the multipass data. | test_process_identity_sets_hard_expiry | python | indico/indico | indico/modules/auth/auth_test.py | https://github.com/indico/indico/blob/master/indico/modules/auth/auth_test.py | MIT |
def test_process_identity_raises_exc_for_non_dt_hard_expiry(app):
"""Test that a ValueError is raised if the hard expiry is not a datetime object."""
identity_info = IdentityInfo(
provider=StaticIdentityProvider(
multipass=Multipass(), name='static', settings={}
),
identifier... | Test that a ValueError is raised if the hard expiry is not a datetime object. | test_process_identity_raises_exc_for_non_dt_hard_expiry | python | indico/indico | indico/modules/auth/auth_test.py | https://github.com/indico/indico/blob/master/indico/modules/auth/auth_test.py | MIT |
def _get_verified_email(self):
"""Check if there is an email verification token."""
try:
token = request.args['token']
except KeyError:
return None, None
try:
return secure_serializer.loads(token, max_age=3600, salt='register-email'), False
exc... | Check if there is an email verification token. | _get_verified_email | python | indico/indico | indico/modules/auth/controllers.py | https://github.com/indico/indico/blob/master/indico/modules/auth/controllers.py | MIT |
def save_identity_info(identity_info, user):
"""Save information from IdentityInfo in the session."""
trusted_email = identity_info.provider.settings.get('trusted_email', False)
session['login_identity_info'] = {
'provider': identity_info.provider.name,
'provider_title': identity_info.provid... | Save information from IdentityInfo in the session. | save_identity_info | python | indico/indico | indico/modules/auth/util.py | https://github.com/indico/indico/blob/master/indico/modules/auth/util.py | MIT |
def load_identity_info():
"""Retrieve identity information from the session."""
try:
info = session['login_identity_info'].copy()
except KeyError:
return None
# Restoring a multidict is quite ugly...
data = info.pop('data')
info['data'] = MultiDict()
info['data'].update(data)... | Retrieve identity information from the session. | load_identity_info | python | indico/indico | indico/modules/auth/util.py | https://github.com/indico/indico/blob/master/indico/modules/auth/util.py | MIT |
def register_user(email, extra_emails, user_data, identity_data, settings, from_moderation=False):
"""
Create a user based on the registration data provided during the
user registration process (via `RHRegister` and `RegistrationHandler`).
This method is not meant to be used for generic user creation, ... |
Create a user based on the registration data provided during the
user registration process (via `RHRegister` and `RegistrationHandler`).
This method is not meant to be used for generic user creation, the
only reason why this is here is that approving a registration request
is handled by the `users... | register_user | python | indico/indico | indico/modules/auth/util.py | https://github.com/indico/indico/blob/master/indico/modules/auth/util.py | MIT |
def impersonate_user(user):
"""Impersonate another user as an admin."""
from indico.modules.auth import logger, login_user
current_user = session.user
# We don't overwrite a previous entry - the original (admin) user should be kept there
# XXX: Don't change this to setdefault - building `session_da... | Impersonate another user as an admin. | impersonate_user | python | indico/indico | indico/modules/auth/util.py | https://github.com/indico/indico/blob/master/indico/modules/auth/util.py | MIT |
def undo_impersonate_user():
"""Undo an admin impersonation login and revert to the old user."""
from indico.modules.auth import logger
from indico.modules.users import User
try:
entry = session.pop('login_as_orig_user')
except KeyError:
# The user probably already switched back fro... | Undo an admin impersonation login and revert to the old user. | undo_impersonate_user | python | indico/indico | indico/modules/auth/util.py | https://github.com/indico/indico/blob/master/indico/modules/auth/util.py | MIT |
def redirect_to_login(next_url=None, reason=None):
"""Redirect to the login page.
:param next_url: URL to be redirected upon successful login. If not
specified, it will be set to ``request.relative_url``.
:param reason: Why the user is redirected to a login page.
"""
if not nex... | Redirect to the login page.
:param next_url: URL to be redirected upon successful login. If not
specified, it will be set to ``request.relative_url``.
:param reason: Why the user is redirected to a login page.
| redirect_to_login | python | indico/indico | indico/modules/auth/util.py | https://github.com/indico/indico/blob/master/indico/modules/auth/util.py | MIT |
def url_for_register(next_url=None, email=None):
"""Returns the URL to register.
:param next_url: The URL to redirect to afterwards.
:param email: A pre-validated email address to use when creating
a new local account. Use this argument ONLY when
sending the link in an ... | Returns the URL to register.
:param next_url: The URL to redirect to afterwards.
:param email: A pre-validated email address to use when creating
a new local account. Use this argument ONLY when
sending the link in an email or if the email address
has alre... | url_for_register | python | indico/indico | indico/modules/auth/util.py | https://github.com/indico/indico/blob/master/indico/modules/auth/util.py | MIT |
def login_user(user, identity=None, admin_impersonation=False):
"""Set the session user and performs on-login logic.
When specifying `identity`, the provider/identitifer information
is saved in the session so the identity management page can prevent
the user from removing the identity he used to login.... | Set the session user and performs on-login logic.
When specifying `identity`, the provider/identitifer information
is saved in the session so the identity management page can prevent
the user from removing the identity he used to login.
:param user: The :class:`~indico.modules.users.User` to log in to... | login_user | python | indico/indico | indico/modules/auth/__init__.py | https://github.com/indico/indico/blob/master/indico/modules/auth/__init__.py | MIT |
def serialize_categories_ical(category_ids, user, event_filter=True, event_filter_fn=None, update_query=None):
"""Export the events in a category to iCal.
:param category_ids: Category IDs to export
:param user: The user who needs to be able to access the events
:param event_filter: A SQLalchemy criter... | Export the events in a category to iCal.
:param category_ids: Category IDs to export
:param user: The user who needs to be able to access the events
:param event_filter: A SQLalchemy criterion to restrict which
events will be returned. Usually something
in... | serialize_categories_ical | python | indico/indico | indico/modules/categories/serialize.py | https://github.com/indico/indico/blob/master/indico/modules/categories/serialize.py | MIT |
def serialize_category_atom(category, url, user, event_filter):
"""Export the events in a category to Atom.
:param category: The category to export
:param url: The URL of the feed
:param user: The user who needs to be able to access the events
:param event_filter: A SQLalchemy criterion to restrict... | Export the events in a category to Atom.
:param category: The category to export
:param url: The URL of the feed
:param user: The user who needs to be able to access the events
:param event_filter: A SQLalchemy criterion to restrict which
events will be returned. Usually somet... | serialize_category_atom | python | indico/indico | indico/modules/categories/serialize.py | https://github.com/indico/indico/blob/master/indico/modules/categories/serialize.py | MIT |
def get(self, category, name, default=SettingsProxyBase.default_sentinel):
"""Retrieve the value of a single setting.
:param category: Category (or its ID)
:param name: Setting name
:param default: Default value in case the setting does not exist
:return: The settings's value or... | Retrieve the value of a single setting.
:param category: Category (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/categories/settings.py | https://github.com/indico/indico/blob/master/indico/modules/categories/settings.py | MIT |
def set(self, category, name, value):
"""Set a single setting.
:param category: Category (or its ID)
:param name: Setting name
:param value: Setting value; must be JSON-serializable
"""
self._check_name(name)
CategorySetting.set(self.module, name, self._convert_f... | Set a single setting.
:param category: Category (or its ID)
:param name: Setting name
:param value: Setting value; must be JSON-serializable
| set | python | indico/indico | indico/modules/categories/settings.py | https://github.com/indico/indico/blob/master/indico/modules/categories/settings.py | MIT |
def set_multi(self, category, items):
"""Set multiple settings at once.
:param category: Category (or its ID)
:param items: Dict containing the new settings
"""
items = {k: self._convert_from_python(k, v) for k, v in items.items()}
CategorySetting.set_multi(self.module, ... | Set multiple settings at once.
:param category: Category (or its ID)
:param items: Dict containing the new settings
| set_multi | python | indico/indico | indico/modules/categories/settings.py | https://github.com/indico/indico/blob/master/indico/modules/categories/settings.py | MIT |
def get_events_by_year(category_id=None):
"""Get the number of events for each year.
:param category_id: The category ID to get statistics for. Events
from subcategories are also included.
:return: A dictionary mapping years to event counts.
"""
category_filter = Event.categ... | Get the number of events for each year.
:param category_id: The category ID to get statistics for. Events
from subcategories are also included.
:return: A dictionary mapping years to event counts.
| get_events_by_year | python | indico/indico | indico/modules/categories/util.py | https://github.com/indico/indico/blob/master/indico/modules/categories/util.py | MIT |
def get_contribs_by_year(category_id=None):
"""Get the number of contributions for each year.
:param category_id: The category ID to get statistics for.
Contributions from subcategories are also
included.
:return: A dictionary mapping years to contribution co... | Get the number of contributions for each year.
:param category_id: The category ID to get statistics for.
Contributions from subcategories are also
included.
:return: A dictionary mapping years to contribution counts.
| get_contribs_by_year | python | indico/indico | indico/modules/categories/util.py | https://github.com/indico/indico/blob/master/indico/modules/categories/util.py | MIT |
def get_min_year(category_id=None):
"""Get the min year.
:param category_id: The category ID to get statistics for.
:return: The year.
"""
category_filter = Event.category_chain_overlaps(category_id) if category_id else True
min_dt = db.session.query(db.func.min(Event.created_dt)).filter(~Event... | Get the min year.
:param category_id: The category ID to get statistics for.
:return: The year.
| get_min_year | python | indico/indico | indico/modules/categories/util.py | https://github.com/indico/indico/blob/master/indico/modules/categories/util.py | MIT |
def get_attachment_count(category_id=None):
"""Get the number of attachments in events in a category.
:param category_id: The category ID to get statistics for.
Attachments from subcategories are also
included.
:return: The number of attachments
"""
c... | Get the number of attachments in events in a category.
:param category_id: The category ID to get statistics for.
Attachments from subcategories are also
included.
:return: The number of attachments
| get_attachment_count | python | indico/indico | indico/modules/categories/util.py | https://github.com/indico/indico/blob/master/indico/modules/categories/util.py | MIT |
def get_category_stats(category_id=None):
"""Get category statistics.
This function is mainly a helper so we can get and cache
all values at once and keep a last-update timestamp.
:param category_id: The category ID to get statistics for.
Subcategories are also included.
""... | Get category statistics.
This function is mainly a helper so we can get and cache
all values at once and keep a last-update timestamp.
:param category_id: The category ID to get statistics for.
Subcategories are also included.
| get_category_stats | python | indico/indico | indico/modules/categories/util.py | https://github.com/indico/indico/blob/master/indico/modules/categories/util.py | MIT |
def get_upcoming_events():
"""Get the global list of upcoming events."""
from indico.modules.events import Event
data = upcoming_events_settings.get_all()
if not data['max_entries'] or not data['entries']:
return
tz = timezone(config.DEFAULT_TIMEZONE)
now = now_utc(False).astimezone(tz)
... | Get the global list of upcoming events. | get_upcoming_events | python | indico/indico | indico/modules/categories/util.py | https://github.com/indico/indico/blob/master/indico/modules/categories/util.py | MIT |
def get_visibility_options(category_or_event, allow_invisible=True):
"""Return the visibility options available for the category or event."""
if isinstance(category_or_event, Event):
category = category_or_event.category
event = category_or_event
else:
category = category_or_event
... | Return the visibility options available for the category or event. | get_visibility_options | python | indico/indico | indico/modules/categories/util.py | https://github.com/indico/indico/blob/master/indico/modules/categories/util.py | MIT |
def serialize_category_role(role, legacy=True):
"""Serialize role to JSON-like object."""
if legacy:
return {
'id': role.id,
'name': role.name,
'code': role.code,
'color': role.color,
'category': role.category.title,
'identifier': f... | Serialize role to JSON-like object. | serialize_category_role | python | indico/indico | indico/modules/categories/util.py | https://github.com/indico/indico/blob/master/indico/modules/categories/util.py | MIT |
def log(self, realm, kind, module, summary, user=None, type_='simple', data=None, meta=None):
"""Create a new log entry for the category.
:param realm: A value from :class:`.CategoryLogRealm` indicating
the realm of the action.
:param kind: A value from :class:`.LogKind` i... | Create a new log entry for the category.
:param realm: A value from :class:`.CategoryLogRealm` indicating
the realm of the action.
:param kind: A value from :class:`.LogKind` indicating
the kind of the action that was performed.
:param module: A human-... | log | python | indico/indico | indico/modules/categories/models/categories.py | https://github.com/indico/indico/blob/master/indico/modules/categories/models/categories.py | MIT |
def can_create_events(self, user):
"""Check whether the user can create events in the category."""
# if creation is not restricted anyone who can access the category
# can also create events in it, otherwise only people with the
# creation role can
return user and ((self.event_cr... | Check whether the user can create events in the category. | can_create_events | python | indico/indico | indico/modules/categories/models/categories.py | https://github.com/indico/indico/blob/master/indico/modules/categories/models/categories.py | MIT |
def move(self, target: 'Category'):
"""Move the category into another category."""
assert not self.is_root
old_parent = self.parent
self.position = (max(x.position for x in target.children) + 1) if target.children else 1
self.parent = target
db.session.flush()
sig... | Move the category into another category. | move | python | indico/indico | indico/modules/categories/models/categories.py | https://github.com/indico/indico/blob/master/indico/modules/categories/models/categories.py | MIT |
def get_tree_cte(cls, col='id'):
"""Create a CTE for the category tree.
The CTE contains the following columns:
- ``id`` -- the category id
- ``path`` -- an array containing the path from the root to
the category itself
- ``is_deleted`` -- whether the cate... | Create a CTE for the category tree.
The CTE contains the following columns:
- ``id`` -- the category id
- ``path`` -- an array containing the path from the root to
the category itself
- ``is_deleted`` -- whether the category is deleted
:param col: The nam... | get_tree_cte | python | indico/indico | indico/modules/categories/models/categories.py | https://github.com/indico/indico/blob/master/indico/modules/categories/models/categories.py | MIT |
def deep_children_query(self):
"""Get a query object for all subcategories.
This includes subcategories at any level of nesting.
"""
cte = Category.get_tree_cte()
return (Category.query
.join(cte, Category.id == cte.c.id)
.filter(cte.c.path.contai... | Get a query object for all subcategories.
This includes subcategories at any level of nesting.
| deep_children_query | python | indico/indico | indico/modules/categories/models/categories.py | https://github.com/indico/indico/blob/master/indico/modules/categories/models/categories.py | MIT |
def nth_parent(self, n_categs, fail_on_overflow=True):
"""Return the nth parent of the category.
:param n_categs: the number of categories to go up
:param fail_on_overflow: whether to fail if we try to go above the root category
:return: `Category` object or None (only if ``fail_on_over... | Return the nth parent of the category.
:param n_categs: the number of categories to go up
:param fail_on_overflow: whether to fail if we try to go above the root category
:return: `Category` object or None (only if ``fail_on_overflow`` is not set)
| nth_parent | python | indico/indico | indico/modules/categories/models/categories.py | https://github.com/indico/indico/blob/master/indico/modules/categories/models/categories.py | MIT |
def visibility_horizon_query(self):
"""Get a query object that returns the highest category this one is visible from."""
cte_query = (select([Category.id, Category.parent_id,
db.case([(Category.visibility.is_(None), None)],
else_=(Categor... | Get a query object that returns the highest category this one is visible from. | visibility_horizon_query | python | indico/indico | indico/modules/categories/models/categories.py | https://github.com/indico/indico/blob/master/indico/modules/categories/models/categories.py | MIT |
def own_visibility_horizon(self):
"""
Get the highest category this one would like to be visible
from (configured visibility).
"""
if self.visibility is None:
return Category.get_root()
else:
return self.nth_parent(self.visibility - 1) |
Get the highest category this one would like to be visible
from (configured visibility).
| own_visibility_horizon | python | indico/indico | indico/modules/categories/models/categories.py | https://github.com/indico/indico/blob/master/indico/modules/categories/models/categories.py | MIT |
def get_visible_categories_cte(category_id):
"""
Get a sqlalchemy select for the visible categories within
the given category, including the category itself.
"""
cte_query = (select([Category.id, literal(0).label('level')])
.where((Category.id == category_id)... |
Get a sqlalchemy select for the visible categories within
the given category, including the category itself.
| get_visible_categories_cte | python | indico/indico | indico/modules/categories/models/categories.py | https://github.com/indico/indico/blob/master/indico/modules/categories/models/categories.py | MIT |
def visible_categories_query(self):
"""
Get a query object for the visible categories within
this category, including the category itself.
"""
cte_query = Category.get_visible_categories_cte(self.id)
return Category.query.join(cte_query, Category.id == cte_query.c.id) |
Get a query object for the visible categories within
this category, including the category itself.
| visible_categories_query | python | indico/indico | indico/modules/categories/models/categories.py | https://github.com/indico/indico/blob/master/indico/modules/categories/models/categories.py | MIT |
def get_hidden_events(self, user=None):
"""Get all hidden events within the given category and user."""
from indico.modules.events import Event
hidden_events = Event.query.with_parent(self).filter_by(visibility=0).all()
return [event for event in hidden_events if not event.can_display(us... | Get all hidden events within the given category and user. | get_hidden_events | python | indico/indico | indico/modules/categories/models/categories.py | https://github.com/indico/indico/blob/master/indico/modules/categories/models/categories.py | MIT |
def effective_icon_url(self):
"""Get the HTTP URL of the icon (possibly inherited)."""
data = self.effective_icon_data
return url_for('categories.display_icon', category_id=data['source_id'], slug=data['metadata']['hash']) | Get the HTTP URL of the icon (possibly inherited). | effective_icon_url | python | indico/indico | indico/modules/categories/models/categories.py | https://github.com/indico/indico/blob/master/indico/modules/categories/models/categories.py | MIT |
def get_category_roles(cat):
"""Get the category roles available for the specified category."""
if cat is None:
return []
return CategoryRole.query.join(cat.chain_query.subquery()).order_by(CategoryRole.code).all() | Get the category roles available for the specified category. | get_category_roles | python | indico/indico | indico/modules/categories/models/roles.py | https://github.com/indico/indico/blob/master/indico/modules/categories/models/roles.py | MIT |
def generate_captcha_challenge():
"""Generate 4-digit CAPTCHA as image and audio."""
# we skip 1 since it's too similar to 7; when verifying we accept both digits
answer = ''.join(random.choices('023456789', k=4))
image = ImageCaptcha().generate(answer).read()
audio = AudioCaptcha().generate(answer)... | Generate 4-digit CAPTCHA as image and audio. | generate_captcha_challenge | python | indico/indico | indico/modules/core/captcha.py | https://github.com/indico/indico/blob/master/indico/modules/core/captcha.py | MIT |
def _validate_backside_template(self, backside_template):
"""Verify if the given template can be used as a backside for the current template.
A template can be used as a backside if:
- frontside != backside
- backside does't already have its own backside
- it has the... | Verify if the given template can be used as a backside for the current template.
A template can be used as a backside if:
- frontside != backside
- backside does't already have its own backside
- it has the same size as the frontside
- the templates are linked to... | _validate_backside_template | python | indico/indico | indico/modules/designer/controllers.py | https://github.com/indico/indico/blob/master/indico/modules/designer/controllers.py | MIT |
def update_template(template, title, data, is_clonable, backside_template_id=None, clear_background=False):
"""Update an existing template.
:param template: The template to be updated
:param title: An `EventType` value
:param data: A dict containing the template data (width, height, items, etc)
:pa... | Update an existing template.
:param template: The template to be updated
:param title: An `EventType` value
:param data: A dict containing the template data (width, height, items, etc)
:param is_clonable: Whether it is possible to clone this template
:param backside_template_id: The ID of the templ... | update_template | python | indico/indico | indico/modules/designer/operations.py | https://github.com/indico/indico/blob/master/indico/modules/designer/operations.py | MIT |
def _remove_transparency(self, fd):
"""Remove transparency from an image and replace it with white."""
img = Image.open(fd)
# alpha-channel PNG: replace the transparent areas with plain white
if img.mode == 'RGBA':
new = Image.new(img.mode[:-1], img.size, (255, 255, 255))
... | Remove transparency from an image and replace it with white. | _remove_transparency | python | indico/indico | indico/modules/designer/pdf.py | https://github.com/indico/indico/blob/master/indico/modules/designer/pdf.py | MIT |
def from_designer_item(cls, regform, item):
"""Create an instance of this class from a designer item."""
type_ = item['type']
try:
field_id = int(type_.removeprefix('field-'))
except ValueError:
raise ValueError(f'Invalid field type: {type_}')
field = nex... | Create an instance of this class from a designer item. | from_designer_item | python | indico/indico | indico/modules/designer/placeholders.py | https://github.com/indico/indico/blob/master/indico/modules/designer/placeholders.py | MIT |
def _get_placeholders():
"""Get a list of all designer placeholders."""
exports = [getattr(placeholders, name) for name in placeholders.__all__]
phs = [obj for obj in exports if issubclass(obj, placeholders.DesignerPlaceholder)]
return sorted(phs, key=attrgetter('group', 'name')) | Get a list of all designer placeholders. | _get_placeholders | python | indico/indico | indico/modules/designer/placeholders_test.py | https://github.com/indico/indico/blob/master/indico/modules/designer/placeholders_test.py | MIT |
def get_all_templates(obj):
"""Get all templates usable by an event/category."""
category = (obj.category or Category.get_root()) if isinstance(obj, Event) else obj
return set(DesignerTemplate.query.filter(DesignerTemplate.category_id.in_(categ['id'] for categ in category.chain))) | Get all templates usable by an event/category. | get_all_templates | python | indico/indico | indico/modules/designer/util.py | https://github.com/indico/indico/blob/master/indico/modules/designer/util.py | MIT |
def get_not_deletable_templates(obj):
"""Get all non-deletable templates for an event/category."""
not_deletable_criteria = [
DesignerTemplate.is_system_template,
DesignerTemplate.backside_template_of != None, # noqa: E711
DesignerTemplate.ticket_for_regforms.any(RegistrationForm.event.... | Get all non-deletable templates for an event/category. | get_not_deletable_templates | python | indico/indico | indico/modules/designer/util.py | https://github.com/indico/indico/blob/master/indico/modules/designer/util.py | MIT |
def get_linkable_regforms(template):
"""Return all registration forms that can be linked to the given template."""
if template.category or template.type == TemplateType.poster or template.registration_form:
return []
return [
regform for regform in template.event.registration_forms
... | Return all registration forms that can be linked to the given template. | get_linkable_regforms | python | indico/indico | indico/modules/designer/util.py | https://github.com/indico/indico/blob/master/indico/modules/designer/util.py | MIT |
def get_printable_event_templates(regform):
"""Return all templates that can be used to print badges/tickets for the given registration form.
A template can be used if it is either not linked to anything or linked to the current registation form.
"""
return (
DesignerTemplate.query
.wit... | Return all templates that can be used to print badges/tickets for the given registration form.
A template can be used if it is either not linked to anything or linked to the current registation form.
| get_printable_event_templates | python | indico/indico | indico/modules/designer/util.py | https://github.com/indico/indico/blob/master/indico/modules/designer/util.py | MIT |
def test_get_printable_event_templates(dummy_category, dummy_event, create_regform, create_dummy_designer_template):
"""
Ensure that all templates that are available for printing for a given regform are
either linked to the regform or not linked to any.
"""
create_dummy_designer_template('Category t... |
Ensure that all templates that are available for printing for a given regform are
either linked to the regform or not linked to any.
| test_get_printable_event_templates | python | indico/indico | indico/modules/designer/util_test.py | https://github.com/indico/indico/blob/master/indico/modules/designer/util_test.py | MIT |
def test_can_link_to_regform_category_template(dummy_category, dummy_regform, create_dummy_designer_template):
"""Category templates cannot be linked to registration forms."""
template = create_dummy_designer_template('Template', category=dummy_category)
assert not can_link_to_regform(template, dummy_regfor... | Category templates cannot be linked to registration forms. | test_can_link_to_regform_category_template | python | indico/indico | indico/modules/designer/util_test.py | https://github.com/indico/indico/blob/master/indico/modules/designer/util_test.py | MIT |
def test_can_link_to_regform_poster(dummy_event, dummy_regform, create_dummy_designer_template):
"""Posters cannot be linked to registration forms."""
template = create_dummy_designer_template('Poster', event=dummy_event, type=TemplateType.poster)
assert not can_link_to_regform(template, dummy_regform) | Posters cannot be linked to registration forms. | test_can_link_to_regform_poster | python | indico/indico | indico/modules/designer/util_test.py | https://github.com/indico/indico/blob/master/indico/modules/designer/util_test.py | MIT |
def test_can_link_to_regform_with_backside_1(dummy_event, create_regform, create_dummy_designer_template):
"""Ensure that if the template to be linked has a backside, it must be linked to the same registration form."""
regform_1 = create_regform(dummy_event, title='Registration Form 1')
regform_2 = create_r... | Ensure that if the template to be linked has a backside, it must be linked to the same registration form. | test_can_link_to_regform_with_backside_1 | python | indico/indico | indico/modules/designer/util_test.py | https://github.com/indico/indico/blob/master/indico/modules/designer/util_test.py | MIT |
def is_unlinkable(self):
"""Return `True` if the template can be unlinked from a registration form."""
from indico.modules.designer.util import has_regform_field_placeholders
return not has_regform_field_placeholders(self.data) | Return `True` if the template can be unlinked from a registration form. | is_unlinkable | python | indico/indico | indico/modules/designer/models/templates.py | https://github.com/indico/indico/blob/master/indico/modules/designer/models/templates.py | MIT |
def test_template_is_unlinkable(dummy_designer_template):
"""`template.is_unlinkable` should be `False` if the template contains custom registration placeholders."""
assert dummy_designer_template.is_unlinkable
original_data = dummy_designer_template.data
# Add regform field placeholders to the templat... | `template.is_unlinkable` should be `False` if the template contains custom registration placeholders. | test_template_is_unlinkable | python | indico/indico | indico/modules/designer/models/templates_test.py | https://github.com/indico/indico/blob/master/indico/modules/designer/models/templates_test.py | MIT |
def _build_sessions_api_data(self, sessions):
"""Return an aggregated list of session blocks given the sessions."""
session_blocks = []
for session_ in sessions:
can_manage = self.user is not None and session_.can_manage(self.user)
session_access_list = None
s... | Return an aggregated list of session blocks given the sessions. | _build_sessions_api_data | python | indico/indico | indico/modules/events/api.py | https://github.com/indico/indico/blob/master/indico/modules/events/api.py | MIT |
def requires_deep(cls):
"""All cloner names required by this cloner.
This includes cloners required by a requirement.
"""
cloners = get_event_cloners()
todo = set(cls.requires)
required = set()
while todo:
cloner = todo.pop()
required.add(... | All cloner names required by this cloner.
This includes cloners required by a requirement.
| requires_deep | python | indico/indico | indico/modules/events/cloning.py | https://github.com/indico/indico/blob/master/indico/modules/events/cloning.py | MIT |
def required_by_deep(cls):
"""All cloner names depending on this cloner.
This includes cloners which depend on a cloner depending on
this cloner.
"""
# This is not very efficient, but it runs exactly once on a not-very-large set
return {cloner.name for cloner in get_even... | All cloner names depending on this cloner.
This includes cloners which depend on a cloner depending on
this cloner.
| required_by_deep | python | indico/indico | indico/modules/events/cloning.py | https://github.com/indico/indico/blob/master/indico/modules/events/cloning.py | MIT |
def get_attrs_to_clone(model, add=None, skip=None):
"""Get the set of attributes that should be cloned from a model class.
:param add: A set of attribute names to be added.
:param skip: A set of attribute names to be skipped.
"""
add = set() if add is None else add
skip = set() if skip is None ... | Get the set of attributes that should be cloned from a model class.
:param add: A set of attribute names to be added.
:param skip: A set of attribute names to be skipped.
| get_attrs_to_clone | python | indico/indico | indico/modules/events/cloning.py | https://github.com/indico/indico/blob/master/indico/modules/events/cloning.py | MIT |
def export_event(event_or_category, target_file, *, keep_uuids=False, use_pickle=False, dummy_files=False,
external_files=False, identities=None):
"""Export the specified event/category with all its data to a file.
:param event_or_category: the `Event` to export, or a `Category` to export with... | Export the specified event/category with all its data to a file.
:param event_or_category: the `Event` to export, or a `Category` to export with all
its events and subcategories
:param target_file: a file object to write the data to
:param keep_uuids: preserve uuids between th... | export_event | python | indico/indico | indico/modules/events/export.py | https://github.com/indico/indico/blob/master/indico/modules/events/export.py | MIT |
def import_event_files(handler_import_path, mapping_file):
"""Import files after an event import."""
try:
module_path, class_name = handler_import_path.rsplit('.', 1)
except ValueError:
print(f"{handler_import_path} doesn't look like a module path")
return
module = import_module(... | Import files after an event import. | import_event_files | python | indico/indico | indico/modules/events/export.py | https://github.com/indico/indico/blob/master/indico/modules/events/export.py | MIT |
def _make_globals(**extra):
"""
Build a globals dict for the exec/eval environment that contains
all the models and whatever extra data is needed.
"""
globals_ = {cls.__name__: cls for cls in get_all_models() if hasattr(cls, '__table__')}
globals_.update(extra)
return globals_ |
Build a globals dict for the exec/eval environment that contains
all the models and whatever extra data is needed.
| _make_globals | python | indico/indico | indico/modules/events/export.py | https://github.com/indico/indico/blob/master/indico/modules/events/export.py | MIT |
def _exec_custom(code, **extra):
"""Execute a custom code snippet and return all non-underscored values."""
globals_ = _make_globals(**extra)
locals_ = {}
exec(code, globals_, locals_) # noqa: S102
return {str(k): v for k, v in locals_.items() if k[0] != '_'} | Execute a custom code snippet and return all non-underscored values. | _exec_custom | python | indico/indico | indico/modules/events/export.py | https://github.com/indico/indico/blob/master/indico/modules/events/export.py | MIT |
def _resolve_col(col):
"""Resolve a string or object to a column.
:param col: A string containing a Python expression, a model
attribute or a Column instance.
"""
attr = eval(col, _make_globals()) if isinstance(col, str) else col # noqa: S307
if isinstance(attr, db.Column):
... | Resolve a string or object to a column.
:param col: A string containing a Python expression, a model
attribute or a Column instance.
| _resolve_col | python | indico/indico | indico/modules/events/export.py | https://github.com/indico/indico/blob/master/indico/modules/events/export.py | MIT |
def _get_single_fk(col):
"""Get the single-column FK constraint of the specified column."""
# find the column-specific FK, not some compound fk containing this column
fks = [x for x in col.foreign_keys if len(x.constraint.columns) == 1]
assert len(fks) == 1
return fks[0] | Get the single-column FK constraint of the specified column. | _get_single_fk | python | indico/indico | indico/modules/events/export.py | https://github.com/indico/indico/blob/master/indico/modules/events/export.py | MIT |
def _get_pk(table):
"""Get the single column that is the table's PK."""
pks = list(inspect(table).primary_key.columns.values())
assert len(pks) == 1
return pks[0] | Get the single column that is the table's PK. | _get_pk | python | indico/indico | indico/modules/events/export.py | https://github.com/indico/indico/blob/master/indico/modules/events/export.py | MIT |
def _get_reverse_fk_map(self):
"""Build a mapping between columns and incoming FKs."""
legacy_tables = {'events.legacy_contribution_id_map', 'events.legacy_subcontribution_id_map',
'attachments.legacy_attachment_id_map', 'event_registration.legacy_registration_map',
... | Build a mapping between columns and incoming FKs. | _get_reverse_fk_map | python | indico/indico | indico/modules/events/export.py | https://github.com/indico/indico/blob/master/indico/modules/events/export.py | MIT |
def _make_idref(self, column, value, incoming=False, target_column=None):
"""Generate a ID reference.
When generating an incoming ID reference, `column` must be a PK
and point to the column that is referenced by FKs. In this case
the `value` is ignored since it will be auto-generated b... | Generate a ID reference.
When generating an incoming ID reference, `column` must be a PK
and point to the column that is referenced by FKs. In this case
the `value` is ignored since it will be auto-generated by the db
when the new row is inserted.
Otherwise, exactly one of `co... | _make_idref | python | indico/indico | indico/modules/events/export.py | https://github.com/indico/indico/blob/master/indico/modules/events/export.py | MIT |
def _make_value(self, value):
"""Convert values that need extra handling."""
if isinstance(value, (date, datetime)):
# YAML loses timezone information for datatime objects so
# we serialize/deserialize it manually
return type(value).__name__, value.isoformat()
... | Convert values that need extra handling. | _make_value | python | indico/indico | indico/modules/events/export.py | https://github.com/indico/indico/blob/master/indico/modules/events/export.py | MIT |
def _process_file(self, data):
"""Copy a file from storage into the export archive."""
if data.get('storage_file_id') is None:
return
assert '__file__' not in data # only one file per row allowed
storage_backend = data.pop('storage_backend')
storage_file_id = data.po... | Copy a file from storage into the export archive. | _process_file | python | indico/indico | indico/modules/events/export.py | https://github.com/indico/indico/blob/master/indico/modules/events/export.py | MIT |
def generate_basic_component(
entity: Event | Session | Contribution,
uid: str | None = None,
url: str | None = None,
title: str | None = None,
description: str | None = None,
organizer: tuple[str, str] | None = None
):
"""Generate an iCalendar component with basic common properties.
:p... | Generate an iCalendar component with basic common properties.
:param entity: Event/session/contribution where properties come from
:param uid: UID for the component
:param url: URL for the component (defaults to `entity.external_url`)
:param title: A title for the component
:param description: A te... | generate_basic_component | python | indico/indico | indico/modules/events/ical.py | https://github.com/indico/indico/blob/master/indico/modules/events/ical.py | MIT |
def generate_event_component(
event: Event,
user: User | None = None,
organizer: tuple[str, str] | None = None,
skip_access_check: bool | None = False,
):
"""Generate an event icalendar component from an Indico event."""
uid = event.ical_uid
component = generate_basic_component(event, uid, o... | Generate an event icalendar component from an Indico event. | generate_event_component | python | indico/indico | indico/modules/events/ical.py | https://github.com/indico/indico/blob/master/indico/modules/events/ical.py | MIT |
def event_to_ical(
event: Event,
user: User | None = None,
scope: str | None = None,
*,
skip_access_check: bool = False,
method: str | None = None,
organizer: tuple[str, str] | None = None
):
"""Serialize an event into an ical.
:param event: The event to serialize
:param user: T... | Serialize an event into an ical.
:param event: The event to serialize
:param user: The user who needs to be able to access the events
:param scope: If specified, use a more detailed timetable using the given scope
:param skip_access_check: Do not perform access checks. Defaults to False.
:param met... | event_to_ical | python | indico/indico | indico/modules/events/ical.py | https://github.com/indico/indico/blob/master/indico/modules/events/ical.py | MIT |
def events_to_ical(
events: list[Event],
user: User | None = None,
scope: str | None = None,
*,
skip_access_check: bool = False,
method: str | None = None,
organizer: tuple[str, str] | None = None
):
"""Serialize multiple events into an ical.
:param events: A list of events to seria... | Serialize multiple events into an ical.
:param events: A list of events to serialize
:param user: The user who needs to be able to access the events
:param scope: If specified, use a more detailed timetable using the given scope
:param skip_access_check: Do not perform access checks. Defaults to False.... | events_to_ical | python | indico/indico | indico/modules/events/ical.py | https://github.com/indico/indico/blob/master/indico/modules/events/ical.py | MIT |
def notify_event_creation(event, occurrences=None):
"""Send email notifications when a new Event is created.
:param event: The `Event` that has been created.
:param occurrences: A list of event occurrences in case of a
series of events. If specified, the links
... | Send email notifications when a new Event is created.
:param event: The `Event` that has been created.
:param occurrences: A list of event occurrences in case of a
series of events. If specified, the links
and dates/times are only taken from the
... | notify_event_creation | python | indico/indico | indico/modules/events/notifications.py | https://github.com/indico/indico/blob/master/indico/modules/events/notifications.py | MIT |
def notify_move_request_creation(events, target_category, comment=''):
"""Send email notifications when a move request is created.
:param events: List of events requested to move.
:param target_category: The category to move the events into.
:param comment: Optional requestor's comment.
"""
ema... | Send email notifications when a move request is created.
:param events: List of events requested to move.
:param target_category: The category to move the events into.
:param comment: Optional requestor's comment.
| notify_move_request_creation | python | indico/indico | indico/modules/events/notifications.py | https://github.com/indico/indico/blob/master/indico/modules/events/notifications.py | MIT |
def notify_move_request_closure(move_requests, accept, reason=''):
"""Send email notifications when a move request is accepted/rejected.
:param move_requests: List of `EventMoveRequest` that were accepted/rejected.
:param accept: Whether the requests were accepted.
:param reason: Optional reason for re... | Send email notifications when a move request is accepted/rejected.
:param move_requests: List of `EventMoveRequest` that were accepted/rejected.
:param accept: Whether the requests were accepted.
:param reason: Optional reason for rejection.
| notify_move_request_closure | python | indico/indico | indico/modules/events/notifications.py | https://github.com/indico/indico/blob/master/indico/modules/events/notifications.py | MIT |
def create_event(category, event_type, data, add_creator_as_manager=True, features=None, cloning=False):
"""Create a new event.
:param category: The category in which to create the event
:param event_type: An `EventType` value
:param data: A dict containing data used to populate the event
:param ad... | Create a new event.
:param category: The category in which to create the event
:param event_type: An `EventType` value
:param data: A dict containing data used to populate the event
:param add_creator_as_manager: Whether the creator (current user)
should be added as a... | create_event | python | indico/indico | indico/modules/events/operations.py | https://github.com/indico/indico/blob/master/indico/modules/events/operations.py | MIT |
def clone_event(event, n_occurrence, start_dt, cloners, category=None, refresh_users=False):
"""Clone an event on a given date/time.
Runs all required cloners.
:param n_occurrence: The 1-indexed number of the occurrence, if this is a "recurring" clone, otherwise `0`
:param start_dt: The start datetime... | Clone an event on a given date/time.
Runs all required cloners.
:param n_occurrence: The 1-indexed number of the occurrence, if this is a "recurring" clone, otherwise `0`
:param start_dt: The start datetime of the new event;
:param cloners: A set containing the names of all enabled cloners;
:param... | clone_event | python | indico/indico | indico/modules/events/operations.py | https://github.com/indico/indico/blob/master/indico/modules/events/operations.py | MIT |
def clone_into_event(source_event, target_event, cloners):
"""Clone data into an existing event.
Runs all required cloners.
:param source_event: The `Event` to clone data from;
:param target_event: The `Event` to clone data into;
:param cloners: A set containing the names of all enabled cloners.
... | Clone data into an existing event.
Runs all required cloners.
:param source_event: The `Event` to clone data from;
:param target_event: The `Event` to clone data into;
:param cloners: A set containing the names of all enabled cloners.
| clone_into_event | python | indico/indico | indico/modules/events/operations.py | https://github.com/indico/indico/blob/master/indico/modules/events/operations.py | MIT |
def _draw_poster(self, canvas, registration, pos_x, pos_y):
"""
Draw a badge for a given registration, at position pos_x,
pos_y (top-left corner).
"""
config = self.config
tpl_data = self.tpl_data
badge_rect = (pos_x, self.height - pos_y - tpl_data.height_cm * cm... |
Draw a badge for a given registration, at position pos_x,
pos_y (top-left corner).
| _draw_poster | python | indico/indico | indico/modules/events/posters.py | https://github.com/indico/indico/blob/master/indico/modules/events/posters.py | MIT |
def get(self, event, name):
"""Retrieve an ACL setting.
:param event: Event (or its ID)
:param name: Setting name
"""
self._check_name(name)
return get_setting_acl(EventSettingPrincipal, self, name, self._cache, event_id=event) | Retrieve an ACL setting.
:param event: Event (or its ID)
:param name: Setting name
| 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, acl):
"""Replace an ACL with a new one.
:param event: Event (or its ID)
:param name: Setting name
:param acl: A set containing principals (users/groups)
"""
self._check_name(name)
EventSettingPrincipal.set_acl(self.module, name, acl, ev... | Replace an ACL with a new one.
:param event: Event (or its ID)
:param name: Setting name
:param acl: A set containing principals (users/groups)
| set | python | indico/indico | indico/modules/events/settings.py | https://github.com/indico/indico/blob/master/indico/modules/events/settings.py | MIT |
def contains_user(self, event, name, user):
"""Check if a user is in an ACL.
To pass this check, the user can either be in the ACL itself
or in a group in the ACL.
:param event: Event (or its ID)
:param name: Setting name
:param user: A :class:`.User`
"""
... | Check if a user is in an ACL.
To pass this check, the user can either be in the ACL itself
or in a group in the ACL.
:param event: Event (or its ID)
:param name: Setting name
:param user: A :class:`.User`
| contains_user | python | indico/indico | indico/modules/events/settings.py | https://github.com/indico/indico/blob/master/indico/modules/events/settings.py | MIT |
def add_principal(self, event, name, principal):
"""Add a principal to an ACL.
:param event: Event (or its ID)
:param name: Setting name
:param principal: A :class:`.User` or a :class:`.GroupProxy`
"""
self._check_name(name)
EventSettingPrincipal.add_principal(se... | Add a principal to an ACL.
:param event: Event (or its ID)
:param name: Setting name
:param principal: A :class:`.User` or a :class:`.GroupProxy`
| add_principal | python | indico/indico | indico/modules/events/settings.py | https://github.com/indico/indico/blob/master/indico/modules/events/settings.py | MIT |
def remove_principal(self, event, name, principal):
"""Remove a principal from an ACL.
:param event: Event (or its ID)
:param name: Setting name
:param principal: A :class:`.User` or a :class:`.GroupProxy`
"""
self._check_name(name)
EventSettingPrincipal.remove_p... | Remove a principal from an ACL.
:param event: Event (or its ID)
:param name: Setting name
:param principal: A :class:`.User` or a :class:`.GroupProxy`
| remove_principal | python | indico/indico | indico/modules/events/settings.py | https://github.com/indico/indico/blob/master/indico/modules/events/settings.py | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.