示例#1
0
文件: util.py 项目: pmart123/indico
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]
    }
示例#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
示例#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
示例#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
    }
示例#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
    }
示例#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]
    }
示例#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
示例#8
0
文件: fields.py 项目: nyimbi/indico
 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
示例#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
示例#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
示例#11
0
 def _serialize_person_link(self, principal, extra_data=None):
     extra_data = extra_data or {}
     return dict(extra_data, **serialize_person_link(principal))
示例#12
0
文件: fields.py 项目: OmeGak/indico
 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
示例#13
0
文件: fields.py 项目: indico/indico
 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
示例#14
0
 def _serialize_person_link(self, principal, extra_data=None):
     return (extra_data or {}) | serialize_person_link(principal)