def handle_calendar_deletes(namespace_id, deleted_calendar_uids, log, db_session):
 deleted_count = 0
 for uid in deleted_calendar_uids:
  local_calendar = db_session.query(Calendar).filter((Calendar.namespace_id == namespace_id), (Calendar.uid == uid)).first()
  if (local_calendar is not None):
   _delete_calendar(db_session, local_calendar)
   deleted_count += 1
 log.info('deleted calendars', deleted=deleted_count)

def handle_calendar_deletes ( namespace_id , deleted_calendar_uids , log , db_session ) : deleted_count = 0 for uid in deleted_calendar_uids : local_calendar = db_session . query ( Calendar ) . filter ( ( Calendar . namespace_id == namespace_id ) , ( Calendar . uid == uid ) ) . first ( ) if ( local_calendar is not None ) : _delete_calendar ( db_session , local_calendar ) deleted_count += 1 log . info ( 'deleted calendars' , deleted = deleted_count )
delete any local calendar rows with uid in deleted_calendar_uids .