Hello,
I am hooking into the “signals.event.session_block_updated” signal to update some services on our site.
When I drag and drop my Session block in the Timetable, the datetime value I get in the hook is still set to the old value and not to the current date/time slot it was dropped in.
Is this by design?
The “signals.event.times_changed” signal for SessionBlock correctly has the date/time value though.
Here is how things look:
signals:
self.connect(signals.event.session_block_updated, self._session_block_updated)
self.connect(signals.event.times_changed, self._event_time_changed, sender=SessionBlock)
my hooks:
def _session_block_updated(self, session_block, **kwargs):
d = session_block.start_dt.astimezone(session_block.event.tzinfo)
print('FROM: "signals.event.session_block_updated", datetime: ', d)
def _event_time_changed(self, sender, obj, **kwargs):
event = obj
d = event.start_dt.astimezone(event.event.tzinfo)
print('FROM "signals.event.times_changed", datetime: ', d)
print(sender, '_event_time_changed SENDER')
I get this in the logs (notice the times difference by 30 minutes: 12:00 being the correct current time ):
| 2023-10-31 15:48:59,672 INFO f7f89298f79d4f1c indico.rh GET /event/56/manage/timetable/entry/99/info [IP=192.168.65.1] [PID=5427]
| 2023-10-31 15:49:01,809 INFO 6ef644238b9e42a6 indico.rh POST /event/56/manage/timetable/entry/99/edit/datetime [IP=192.168.65.1] [PID=5433]
| FROM: "signals.event.session_block_updated", datetime: 2023-10-30 **12:30:00-04:00**
| 2023-10-31 15:49:02,402 INFO 6ef644238b9e42a6 indico.events.sessions Session block <SessionBlock(21): "My session block."> modified by <User(12, me@pi.ca): "My name">
| FROM "signals.event.times_changed", datetime: 2023-10-30 **12:00:00-04:00**
| <class 'indico.modules.events.sessions.models.blocks.SessionBlock'> _event_time_changed SENDER
Cheers