Dirty catch all in GCAL handling
This commit is contained in:
parent
828901111e
commit
a8e6ca89fd
|
@ -19,25 +19,36 @@ logger = logging.getLogger( __name__ )
|
|||
def event_post_save_handler( **kwargs):
|
||||
event = kwargs['instance']
|
||||
created = kwargs['created']
|
||||
if created:
|
||||
logger.info("Creating Gcal event")
|
||||
response = createGCalEvent( getServiceObject(), event ).execute()
|
||||
onGcalEventCreated( None, response, None )
|
||||
else:
|
||||
logger.info( "Updating Gcal event")
|
||||
updateGCalEvent( getServiceObject(),event ).execute()
|
||||
try:
|
||||
if created:
|
||||
logger.info("Creating Gcal event")
|
||||
response = createGCalEvent( getServiceObject(), event ).execute()
|
||||
onGcalEventCreated( None, response, None )
|
||||
else:
|
||||
logger.info( "Updating Gcal event")
|
||||
updateGCalEvent( getServiceObject(),event ).execute()
|
||||
except:
|
||||
logger.error( "Error updating Gcal event")
|
||||
|
||||
|
||||
|
||||
|
||||
@receiver( pre_delete,sender= Event)
|
||||
def event_pre_delete_handler( **kwargs):
|
||||
event = kwargs['instance']
|
||||
logger.info ("Deleting GCAL event")
|
||||
deleteGCalEvent( getServiceObject(), event ).execute()
|
||||
try:
|
||||
event = kwargs['instance']
|
||||
logger.info ("Deleting GCAL event")
|
||||
deleteGCalEvent( getServiceObject(), event ).execute()
|
||||
except:
|
||||
logger.error("Error deleting GCAL event")
|
||||
|
||||
|
||||
@receiver( post_save, sender=EventParticipation )
|
||||
def participation_post_save_handler( **kwargs):
|
||||
participation = kwargs['instance']
|
||||
logger.info("Participation post save -> update gcal")
|
||||
updateGCalEvent( getServiceObject(), participation.event ).execute()
|
||||
try:
|
||||
participation = kwargs['instance']
|
||||
logger.info("Participation post save -> update gcal")
|
||||
updateGCalEvent( getServiceObject(), participation.event ).execute()
|
||||
except:
|
||||
logger.error("Error deleting GCAL event")
|
||||
|
||||
|
|
Loading…
Reference in New Issue