|
131 | 131 | { |
132 | 132 | "data": { |
133 | 133 | "text/plain": [ |
134 | | - "datetime.datetime(2025, 8, 22, 14, 0)" |
| 134 | + "datetime.datetime(2025, 9, 11, 14, 0)" |
135 | 135 | ] |
136 | 136 | }, |
137 | 137 | "execution_count": null, |
|
1724 | 1724 | " req.body_wrap = body_wrap\n", |
1725 | 1725 | " if not resp: resp = await _wrap_call(f, req, sig.parameters)\n", |
1726 | 1726 | " for a in self.after:\n", |
1727 | | - " _,*wreq = await _wrap_req(req, _params(a))\n", |
1728 | | - " nr = a(resp, *wreq)\n", |
| 1727 | + " wreq = await _wrap_req(req, _params(a))\n", |
| 1728 | + " nr = a(*wreq.values())\n", |
1729 | 1729 | " if nr: resp = nr\n", |
1730 | 1730 | " return _resp(req, resp, sig.return_annotation)\n", |
1731 | 1731 | " return _f" |
|
2878 | 2878 | "name": "stdout", |
2879 | 2879 | "output_type": "stream", |
2880 | 2880 | "text": [ |
2881 | | - "Set to 2025-08-22 01:21:53.772537\n" |
| 2881 | + "Set to 2025-09-11 09:53:37.344743\n" |
2882 | 2882 | ] |
2883 | 2883 | }, |
2884 | 2884 | { |
2885 | 2885 | "data": { |
2886 | 2886 | "text/plain": [ |
2887 | | - "'Session time: 2025-08-22 01:21:53.772537'" |
| 2887 | + "'Session time: 2025-09-11 09:53:37.344743'" |
2888 | 2888 | ] |
2889 | 2889 | }, |
2890 | 2890 | "execution_count": null, |
|
3055 | 3055 | "test_eq(cli.get('/locked', auth=(\"testuser\",\"spycraft\")).text, 'Hello, testuser')" |
3056 | 3056 | ] |
3057 | 3057 | }, |
| 3058 | + { |
| 3059 | + "cell_type": "markdown", |
| 3060 | + "id": "967001f3", |
| 3061 | + "metadata": {}, |
| 3062 | + "source": [ |
| 3063 | + "Check that afterware like toasts are called correctly." |
| 3064 | + ] |
| 3065 | + }, |
| 3066 | + { |
| 3067 | + "cell_type": "code", |
| 3068 | + "execution_count": null, |
| 3069 | + "id": "09a5fb96", |
| 3070 | + "metadata": {}, |
| 3071 | + "outputs": [], |
| 3072 | + "source": [ |
| 3073 | + "from fasthtml.toaster import *" |
| 3074 | + ] |
| 3075 | + }, |
| 3076 | + { |
| 3077 | + "cell_type": "code", |
| 3078 | + "execution_count": null, |
| 3079 | + "id": "c7500555", |
| 3080 | + "metadata": {}, |
| 3081 | + "outputs": [], |
| 3082 | + "source": [ |
| 3083 | + "app,cli,rt = get_cli(FastHTML())\n", |
| 3084 | + "setup_toasts(app)\n", |
| 3085 | + "\n", |
| 3086 | + "@rt(\"/\")\n", |
| 3087 | + "def index(sess): \n", |
| 3088 | + " add_toast(sess, \"Successful Page Load!\", \"success\")\n", |
| 3089 | + " return P(\"I love toast!\")" |
| 3090 | + ] |
| 3091 | + }, |
| 3092 | + { |
| 3093 | + "cell_type": "code", |
| 3094 | + "execution_count": null, |
| 3095 | + "id": "0ddf5964", |
| 3096 | + "metadata": {}, |
| 3097 | + "outputs": [], |
| 3098 | + "source": [ |
| 3099 | + "r = cli.get('/')" |
| 3100 | + ] |
| 3101 | + }, |
| 3102 | + { |
| 3103 | + "cell_type": "code", |
| 3104 | + "execution_count": null, |
| 3105 | + "id": "86386f6d", |
| 3106 | + "metadata": {}, |
| 3107 | + "outputs": [], |
| 3108 | + "source": [ |
| 3109 | + "assert 'Successful Page Load!' in r.text" |
| 3110 | + ] |
| 3111 | + }, |
3058 | 3112 | { |
3059 | 3113 | "cell_type": "markdown", |
3060 | 3114 | "id": "6a014add", |
|
3423 | 3477 | { |
3424 | 3478 | "data": { |
3425 | 3479 | "text/plain": [ |
3426 | | - "'Cookie was set at time 01:21:59.994611'" |
| 3480 | + "'Cookie was set at time 09:53:37.455388'" |
3427 | 3481 | ] |
3428 | 3482 | }, |
3429 | 3483 | "execution_count": null, |
|
0 commit comments