Returns a `storage` object with all the request cookies in it. See `storify` for how `requireds` and `defaults` work. This is forgiving on bad HTTP_COOKIE input, it tries to parse at least the cookies it can. The values are converted to unicode if _unicode=True is passed.
(*requireds, **defaults)
| 562 | |
| 563 | |
| 564 | def cookies(*requireds, **defaults): |
| 565 | """Returns a `storage` object with all the request cookies in it. |
| 566 | |
| 567 | See `storify` for how `requireds` and `defaults` work. |
| 568 | |
| 569 | This is forgiving on bad HTTP_COOKIE input, it tries to parse at least |
| 570 | the cookies it can. |
| 571 | |
| 572 | The values are converted to unicode if _unicode=True is passed. |
| 573 | """ |
| 574 | # parse cookie string and cache the result for next time. |
| 575 | if "_parsed_cookies" not in ctx: |
| 576 | http_cookie = ctx.env.get("HTTP_COOKIE", "") |
| 577 | ctx._parsed_cookies = parse_cookies(http_cookie) |
| 578 | |
| 579 | try: |
| 580 | return storify(ctx._parsed_cookies, *requireds, **defaults) |
| 581 | except KeyError: |
| 582 | badrequest() |
| 583 | raise StopIteration() |
| 584 | |
| 585 | |
| 586 | def debug(*args): |
nothing calls this directly
no test coverage detected