Exemple #1
0
def serialize_session_for_ical(sess):
    from indico.modules.events.contributions.util import serialize_contribution_for_ical
    from indico.modules.events.util import serialize_person_link
    return {
        '_fossil':
        'sessionMetadataWithContributions',
        'id':
        sess.id,
        'startDate':
        sess.start_dt,
        'endDate':
        sess.end_dt,
        'url':
        url_for('sessions.display_session', sess, _external=True),
        'title':
        sess.title,
        'location':
        sess.venue_name,
        'roomFullname':
        sess.room_name,
        'description':
        sess.description,
        'speakers': [
            serialize_person_link(x) for c in sess.contributions
            for x in c.speakers
        ],
        'contributions':
        [serialize_contribution_for_ical(c) for c in sess.contributions]
    }
Exemple #2
0
def serialize_contribution_person_link(person_link, is_submitter=None):
    """Serialize ContributionPersonLink to JSON-like object"""
    data = serialize_person_link(person_link)
    data['isSpeaker'] = person_link.is_speaker
    if not isinstance(person_link, SubContributionPersonLink):
        data['authorType'] = person_link.author_type.value
        data['isSubmitter'] = person_link.is_submitter if is_submitter is None else is_submitter
    return data
Exemple #3
0
def serialize_contribution_person_link(person_link, is_submitter=None):
    """Serialize ContributionPersonLink to JSON-like object."""
    data = serialize_person_link(person_link)
    data['isSpeaker'] = person_link.is_speaker
    if not isinstance(person_link, SubContributionPersonLink):
        data['authorType'] = person_link.author_type.value
        data['isSubmitter'] = person_link.is_submitter if is_submitter is None else is_submitter
    return data
Exemple #4
0
def serialize_contribution_for_ical(contrib):
    return {
        '_fossil': 'contributionMetadata',
        'id': contrib.id,
        'startDate': contrib.timetable_entry.start_dt if contrib.timetable_entry else None,
        'endDate': contrib.timetable_entry.end_dt if contrib.timetable_entry else None,
        'url': url_for('contributions.display_contribution', contrib, _external=True),
        'title': contrib.title,
        'location': contrib.venue_name,
        'roomFullname': contrib.room_name,
        'speakers': [serialize_person_link(x) for x in contrib.speakers],
        'description': contrib.description
    }
Exemple #5
0
def serialize_contribution_for_ical(contrib):
    return {
        '_fossil': 'contributionMetadata',
        'id': contrib.id,
        'startDate': contrib.timetable_entry.start_dt if contrib.timetable_entry else None,
        'endDate': contrib.timetable_entry.end_dt if contrib.timetable_entry else None,
        'url': url_for('contributions.display_contribution', contrib, _external=True),
        'title': contrib.title,
        'location': contrib.venue_name,
        'roomFullname': contrib.room_name,
        'speakers': [serialize_person_link(x) for x in contrib.speakers],
        'description': contrib.description
    }
Exemple #6
0
def serialize_session_for_ical(sess):
    from indico.modules.events.contributions.util import serialize_contribution_for_ical
    from indico.modules.events.util import serialize_person_link
    return {
        '_fossil': 'sessionMetadataWithContributions',
        'id': sess.id,
        'startDate': sess.start_dt,
        'endDate': sess.end_dt,
        'url': url_for('sessions.display_session', sess, _external=True),
        'title': sess.title,
        'location': sess.venue_name,
        'roomFullname': sess.room_name,
        'description': sess.description,
        'speakers': [serialize_person_link(x) for c in sess.contributions for x in c.speakers],
        'contributions': [serialize_contribution_for_ical(c) for c in sess.contributions]
    }
Exemple #7
0
 def _serialize_person_link(self, principal, extra_data=None):
     data = (extra_data or {}) | serialize_person_link(principal)
     data['isSpeaker'] = principal.is_speaker
     data['authorType'] = principal.author_type.value
     return data
Exemple #8
0
 def _serialize_person_link(self, principal, extra_data=None):
     extra_data = extra_data or {}
     data = dict(extra_data, **serialize_person_link(principal))
     data['isSubmitter'] = principal.is_submitter
     return data
Exemple #9
0
 def _serialize_person_link(self, principal, extra_data=None):
     extra_data = extra_data or {}
     data = dict(extra_data, **serialize_person_link(principal))
     data['isSubmitter'] = self.data[principal] if self.get_form(
     ).is_submitted() else principal.is_submitter
     return data
Exemple #10
0
 def _serialize_person_link(self, principal, extra_data=None):
     extra_data = extra_data or {}
     data = dict(extra_data, **serialize_person_link(principal))
     data['isSubmitter'] = principal.is_submitter
     return data
Exemple #11
0
 def _serialize_person_link(self, principal, extra_data=None):
     extra_data = extra_data or {}
     return dict(extra_data, **serialize_person_link(principal))
Exemple #12
0
 def _serialize_person_link(self, principal, extra_data=None):
     extra_data = extra_data or {}
     data = dict(extra_data, **serialize_person_link(principal))
     data['isSpeaker'] = principal.is_speaker
     data['authorType'] = principal.author_type.value
     return data
Exemple #13
0
 def _serialize_person_link(self, principal, extra_data=None):
     extra_data = extra_data or {}
     data = dict(extra_data, **serialize_person_link(principal))
     data['isSubmitter'] = self.data[principal] if self.get_form().is_submitted() else principal.is_submitter
     return data
Exemple #14
0
 def _serialize_person_link(self, principal, extra_data=None):
     return (extra_data or {}) | serialize_person_link(principal)