zulip/zerver/tornado
Anders Kaseorg 7657cb4a0f django_api: Extract send_event_on_commit helper.
django-stubs 4.2.1 gives transaction.on_commit a more accurate type
annotation, but this exposed that mypy can’t handle the lambda default
parameters that we use to recapture loop variables such as

    for stream_id in public_stream_ids:
        peer_user_ids = …
        event = …

        transaction.on_commit(
            lambda event=event, peer_user_ids=peer_user_ids: send_event(
                realm, event, peer_user_ids
            )
        )

https://github.com/python/mypy/issues/15459

A workaround that mypy accepts is

        transaction.on_commit(
            (
                lambda event, peer_user_ids: lambda: send_event(
                    realm, event, peer_user_ids
                )
            )(event, peer_user_ids)
        )

But that’s kind of ugly and potentially error-prone, so let’s make a
helper function for this very common pattern.

        send_event_on_commit(realm, event, peer_user_ids)

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-06-19 13:42:40 -07:00
..
__init__.py
application.py tornado: Construct Django BaseHandler once, not per-request. 2022-09-30 11:20:45 -07:00
descriptors.py tornado: Support sharding by user ID. 2022-11-15 17:27:01 -08:00
django_api.py django_api: Extract send_event_on_commit helper. 2023-06-19 13:42:40 -07:00
event_queue.py settings: Add wildcard mention notifications for the followed topics. 2023-06-13 18:01:41 -07:00
exceptions.py exceptions: Update error message for BAD_EVENT_QUEUE_ID. 2022-11-30 17:16:12 -08:00
handlers.py requirements: Upgrade Python requirements. 2023-04-25 21:20:33 -07:00
ioloop_logging.py tornado: Remove instrument_tornado_ioloop. 2022-05-02 17:41:49 -07:00
sharding.py tornado_url: Replace occurrences of `uri` with `url`. 2023-04-26 16:37:16 -07:00
views.py linkifier: Support URL templates for linkifiers. 2023-04-19 12:20:49 -07:00