def _dump_event(event):
 dump = {}
 dump['summary'] = event.title
 dump['description'] = event.description
 dump['location'] = event.location
 dump['transparency'] = ('opaque' if event.busy else 'transparent')
 if event.all_day:
  dump['start'] = {'date': event.start.strftime('%Y-%m-%d')}
  dump['end'] = {'date': event.end.strftime('%Y-%m-%d')}
 else:
  dump['start'] = {'dateTime': event.start.isoformat('T'), 'timeZone': 'UTC'}
  dump['end'] = {'dateTime': event.end.isoformat('T'), 'timeZone': 'UTC'}
 if event.participants:
  dump['attendees'] = []
  inverse_status_map = {value: key for (key, value) in STATUS_MAP.items()}
  for participant in event.participants:
   attendee = {}
   if ('name' in participant):
    attendee['displayName'] = participant['name']
   if ('status' in participant):
    attendee['responseStatus'] = inverse_status_map[participant['status']]
   if ('email' in participant):
    attendee['email'] = participant['email']
   if ('guests' in participant):
    attendee['additionalGuests'] = participant['guests']
   if attendee:
    dump['attendees'].append(attendee)
 return dump

def _dump_event ( event ) : dump = { } dump [ 'summary' ] = event . title dump [ 'description' ] = event . description dump [ 'location' ] = event . location dump [ 'transparency' ] = ( 'opaque' if event . busy else 'transparent' ) if event . all_day : dump [ 'start' ] = { 'date' : event . start . strftime ( '%Y-%m-%d' ) } dump [ 'end' ] = { 'date' : event . end . strftime ( '%Y-%m-%d' ) } else : dump [ 'start' ] = { 'dateTime' : event . start . isoformat ( 'T' ) , 'timeZone' : 'UTC' } dump [ 'end' ] = { 'dateTime' : event . end . isoformat ( 'T' ) , 'timeZone' : 'UTC' } if event . participants : dump [ 'attendees' ] = [ ] inverse_status_map = { value : key for ( key , value ) in STATUS_MAP . items ( ) } for participant in event . participants : attendee = { } if ( 'name' in participant ) : attendee [ 'displayName' ] = participant [ 'name' ] if ( 'status' in participant ) : attendee [ 'responseStatus' ] = inverse_status_map [ participant [ 'status' ] ] if ( 'email' in participant ) : attendee [ 'email' ] = participant [ 'email' ] if ( 'guests' in participant ) : attendee [ 'additionalGuests' ] = participant [ 'guests' ] if attendee : dump [ 'attendees' ] . append ( attendee ) return dump
convert an event db object to the google api json format .