home / github / issue_comments

Menu
  • GraphQL API

issue_comments: 1701826521

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions issue performed_via_github_app
https://github.com/simonw/datasette/issues/2168#issuecomment-1701826521 https://api.github.com/repos/simonw/datasette/issues/2168 1701826521 IC_kwDOBm6k_c5lb8_Z 9599 2023-08-31T21:46:13Z 2023-08-31T21:46:13Z OWNER This could even be a pair of hooks - `process_request()` and `process_response()`. Or could take a leaf from Django, which redesigned middleware to use this pattern instead: ```python def simple_middleware(get_response): # One-time configuration and initialization. def middleware(request): # Code to be executed for each request before # the view (and later middleware) are called. response = get_response(request) # Code to be executed for each request/response after # the view is called. return response return middleware ``` Or even borrow an idea from `pytest` where fixtures can `yield` in the middle, like this: ```python @pytest.fixture def sending_user(mail_admin): user = mail_admin.create_user() yield user mail_admin.delete_user(user) ``` {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} 1876353656  
Powered by Datasette · Queries took 0.896ms