本文整理汇总了Python中indico.modules.events.Event.ends_after方法的典型用法代码示例。如果您正苦于以下问题:Python Event.ends_after方法的具体用法?Python Event.ends_after怎么用?Python Event.ends_after使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类indico.modules.events.Event
的用法示例。
在下文中一共展示了Event.ends_after方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_events_with_linked_sessions
# 需要导入模块: from indico.modules.events import Event [as 别名]
# 或者: from indico.modules.events.Event import ends_after [as 别名]
def get_events_with_linked_sessions(user, dt=None):
"""Returns a dict with keys representing event_id and the values containing
data about the user rights for sessions within the event
:param user: A `User`
:param dt: Only include events taking place on/after that date
"""
query = (user.in_session_acls
.options(load_only('session_id', 'roles', 'full_access', 'read_access'))
.options(noload('*'))
.options(contains_eager(SessionPrincipal.session).load_only('event_id'))
.join(Session)
.join(Event, Event.id == Session.event_id)
.filter(~Session.is_deleted, ~Event.is_deleted, Event.ends_after(dt)))
data = defaultdict(set)
for principal in query:
roles = data[principal.session.event_id]
if 'coordinate' in principal.roles:
roles.add('session_coordinator')
if 'submit' in principal.roles:
roles.add('session_submission')
if principal.full_access:
roles.add('session_manager')
if principal.read_access:
roles.add('session_access')
return data
示例2: get_events_created_by
# 需要导入模块: from indico.modules.events import Event [as 别名]
# 或者: from indico.modules.events.Event import ends_after [as 别名]
def get_events_created_by(user, dt=None):
"""Gets 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))
.options(load_only('id')))
return {event.id for event in query}
示例3: get_events_managed_by
# 需要导入模块: from indico.modules.events import Event [as 别名]
# 或者: from indico.modules.events.Event import ends_after [as 别名]
def get_events_managed_by(user, dt=None):
"""Gets 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)
.options(noload('user'), noload('local_group'), load_only('event_id'))
.filter(~Event.is_deleted, Event.ends_after(dt))
.filter(EventPrincipal.has_management_permission('ANY')))
return {principal.event_id for principal in query}
示例4: get_events_with_submitted_surveys
# 需要导入模块: from indico.modules.events import Event [as 别名]
# 或者: from indico.modules.events.Event import ends_after [as 别名]
def get_events_with_submitted_surveys(user, dt=None):
"""Gets the IDs of events where the user submitted a survey.
:param user: A `User`
:param dt: Only include events taking place on/after that date
:return: A set of event ids
"""
# Survey submissions are not stored in links anymore, so we need to get them directly
query = (user.survey_submissions
.options(load_only('survey_id'))
.options(joinedload(SurveySubmission.survey).load_only('event_id'))
.join(Survey)
.join(Event)
.filter(~Survey.is_deleted, ~Event.is_deleted, Event.ends_after(dt)))
return {submission.survey.event_id for submission in query}
示例5: get_events_with_linked_event_persons
# 需要导入模块: from indico.modules.events import Event [as 别名]
# 或者: from indico.modules.events.Event import ends_after [as 别名]
def get_events_with_linked_event_persons(user, dt=None):
"""
Returns 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 = (user.event_persons
.with_entities(EventPerson.event_id, Event._type)
.join(Event, Event.id == EventPerson.event_id)
.filter(EventPerson.event_links.any())
.filter(~Event.is_deleted, Event.ends_after(dt)))
return {event_id: ('lecture_speaker' if event_type == EventType.lecture else 'conference_chair')
for event_id, event_type in query}
示例6: get_events_with_paper_roles
# 需要导入模块: from indico.modules.events import Event [as 别名]
# 或者: from indico.modules.events.Event import ends_after [as 别名]
def get_events_with_paper_roles(user, dt=None):
"""
Get the IDs and PR roles of events where the user has any kind
of paper reviewing privileges.
:param user: A `User`
:param dt: Only include events taking place on/after that date
:return: A dict mapping event IDs to a set of roles
"""
paper_roles = {'paper_manager', 'paper_judge', 'paper_content_reviewer', 'paper_layout_reviewer'}
role_criteria = [EventPrincipal.has_management_role(role, explicit=True) for role in paper_roles]
query = (user.in_event_acls
.join(Event)
.options(noload('user'), noload('local_group'), load_only('event_id', 'roles'))
.filter(~Event.is_deleted, Event.ends_after(dt))
.filter(db.or_(*role_criteria)))
return {principal.event_id: set(principal.roles) & paper_roles for principal in query}