Re: [Django] #35414: Issue with AsyncClient ignoring default headers compared to synchronous Client

2024-05-09 Thread Django
#35414: Issue with AsyncClient ignoring default headers compared to synchronous
Client
-+-
 Reporter:  설원준(Wonjoon   |Owner:  nobody
  Seol)/Dispatch squad   |
 Type:  Bug  |   Status:  new
Component:  HTTP handling|  Version:  5.0
 Severity:  Normal   |   Resolution:
 Keywords:  AsyncClient, | Triage Stage:  Accepted
  ASGIRequest|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Carlton Gibson):

 This looks correct to me.

 The `generic()` method takes in `headers` and `extra` and combines them
 before passing on to `_base_scope()`:


 {{{
 def generic(...):
 ...
 if headers:
 extra.update(HttpHeaders.to_asgi_names(headers))
 s["headers"] += [
 (key.lower().encode("ascii"), value.encode("latin1"))
 for key, value in extra.items()
 ]
 return self.request(**s)
 }}}

 But then `_base_scope()` isn't then correctly setting the `headers` key in
 the scope (as reported):


 {{{
 def _base_scope(..., **request):
 ...
 "headers": [], # <- scope ignores default header
 **self.defaults,
 **request,
 }}}
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018f6104ced3-3888f299-d10d-432d-aaa2-f320a435a719-00%40eu-central-1.amazonses.com.


Re: [Django] #35414: Issue with AsyncClient ignoring default headers compared to synchronous Client

2024-05-09 Thread Django
#35414: Issue with AsyncClient ignoring default headers compared to synchronous
Client
-+-
 Reporter:  설원준(Wonjoon   |Owner:  nobody
  Seol)/Dispatch squad   |
 Type:  Bug  |   Status:  new
Component:  HTTP handling|  Version:  5.0
 Severity:  Normal   |   Resolution:
 Keywords:  AsyncClient, | Triage Stage:  Accepted
  ASGIRequest|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Natalia Bidart):

 * stage:  Unreviewed => Accepted

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018f5f372ea3-4c785e6b-d4de-41e6-9529-a34f28368f38-00%40eu-central-1.amazonses.com.


Re: [Django] #35414: Issue with AsyncClient ignoring default headers compared to synchronous Client

2024-05-09 Thread Django
#35414: Issue with AsyncClient ignoring default headers compared to synchronous
Client
-+-
 Reporter:  설원준(Wonjoon   |Owner:  nobody
  Seol)/Dispatch squad   |
 Type:  Bug  |   Status:  new
Component:  HTTP handling|  Version:  5.0
 Severity:  Normal   |   Resolution:
 Keywords:  AsyncClient, | Triage Stage:
  ASGIRequest|  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Natalia Bidart):

 * cc: Andrew Godwin, Carlton Gibson (added)

Comment:

 I've been thinking about this report for a while, and after making some
 experiments, I think this is a valid issue. Originally I thought this was
 a dupe of #32159 but I don't think that's the case.

 What I can't put my finger on is whether there is an issue with the docs,
 or if the headers should really be added to the ASGI scope `headers` key
 (as the reporter says). The docs shows:

 > AsyncClient has the same methods and signatures as the synchronous
 (normal) test client, with the following exceptions:
 > In the initialization, arbitrary keyword arguments in defaults are added
 directly into the ASGI scope.
 > Headers passed as extra keyword arguments should not have the HTTP_
 prefix required by the synchronous client (see Client.get()). For example,
 here is how to set an HTTP Accept header:

 To me this implies that the `headers` parameter at class instantiation
 time could be use to set parameters to be used in every client operation
 (just like with `Client`). But when using the test case provided by the
 reporter this is not the case (using a simple Django app with the provided
 middleware and a simple view):

 {{{#!python
 from django.test import TestCase, AsyncClient


 class Ticket35414Tests(TestCase):

 async def test_should_return_ok(self):
 async_client = AsyncClient(headers={"AUTHORIZATION": "A Token"})
 response = await async_client.get("/ticket_35414/")
 self.assertEqual(response.status_code, 200)
 }}}

 Failure:
 {{{
 ==
 FAIL: test_should_return_ok
 (ticket_35414.tests.Ticket35414Tests.test_should_return_ok)
 --
 Traceback (most recent call last):
   File "/home/nessita/.virtualenvs/djangodev/lib/python3.11/site-
 packages/asgiref/sync.py", line 254, in __call__
 return call_result.result()

   File "/usr/lib/python3.11/concurrent/futures/_base.py", line 449, in
 result
 return self.__get_result()
^^^
   File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in
 __get_result
 raise self._exception
   File "/home/nessita/.virtualenvs/djangodev/lib/python3.11/site-
 packages/asgiref/sync.py", line 331, in main_wrap
 result = await self.awaitable(*args, **kwargs)
  ^
   File "/home/nessita/fellowship/projectfromrepo/ticket_35414/tests.py",
 line 9, in test_should_return_ok
 self.assertEqual(response.status_code, 200)
 AssertionError: 401 != 200
 }}}

 Carlton, Andrew, would you have an opinion?
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018f5f35c96a-7a3d0435-e4ac-40e6-97d5-cfa254ad43b3-00%40eu-central-1.amazonses.com.


Re: [Django] #35441: Context autoescape parameter is not documented

2024-05-09 Thread Django
#35441: Context autoescape parameter is not documented
--+
 Reporter:  Roman Donchenko   |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Template system   |  Version:  5.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Natalia Bidart):

 * component:  Documentation => Template system
 * stage:  Unreviewed => Accepted
 * type:  Bug => Cleanup/optimization

Comment:

 Hello Roman,

 I have followed the docs and pointers you provided and I think you are
 right, the `Context` docs could use some improving. Would you be willing
 to help making a patch? Thank you!
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018f5f189ca8-22337c12-b4ab-495d-8f03-b6ff6d0ab10c-00%40eu-central-1.amazonses.com.


Re: [Django] #35404: Admin fieldset multiple flexbox regressions

2024-05-09 Thread Django
#35404: Admin fieldset multiple flexbox regressions
+
 Reporter:  minusf  |Owner:  nobody
 Type:  Bug |   Status:  new
Component:  contrib.admin   |  Version:  4.2
 Severity:  Normal  |   Resolution:
 Keywords:  css admin fieldset  | Triage Stage:  Accepted
Has patch:  1   |  Needs documentation:  0
  Needs tests:  0   |  Patch needs improvement:  0
Easy pickings:  0   |UI/UX:  1
+
Comment (by minusf):

 Regarding `help_text`, I think that with this small font `line-height:
 normal` is not enough:
 {{{#!diff
 M django/contrib/admin/static/admin/css/base.css
 @@ -268,6 +268,7 @@ hr {
  .help, p.help, form p.help, div.help, form div.help, div.help li {
  font-size: 0.6875rem;
  color: var(--body-quiet-color);
 +line-height: 1.5;
  }
 ·
  div.help ul {
 }}}
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018f5efe4f46-a98b022f-be49-4051-9d19-32f07ddbe5cc-00%40eu-central-1.amazonses.com.


Re: [Django] #35439: Hardcoded HTML in python code.

2024-05-09 Thread Django
#35439: Hardcoded HTML in python code.
-+-
 Reporter:  sesostris|Owner:  nobody
 Type:   |   Status:  closed
  Cleanup/optimization   |
Component:  contrib.admin|  Version:  5.0
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Natalia Bidart):

 I would also like to read the answer to the last question (''why using a
 widget and rending the HTML using the template engine would be better'')
 but is worth nothing that the following diff has the test passing OK so at
 a code level it seems equivalent:

 {{{#!diff
 diff --git a/django/contrib/admin/templatetags/admin_list.py
 b/django/contrib/admin/templatetags/admin_list.py
 index fdf6e63f5f..e7b4fcb81f 100644
 --- a/django/contrib/admin/templatetags/admin_list.py
 +++ b/django/contrib/admin/templatetags/admin_list.py
 @@ -1,5 +1,6 @@
  import datetime

 +from django.forms import CheckboxInput
  from django.contrib.admin.templatetags.admin_urls import
 add_preserved_filters
  from django.contrib.admin.utils import (
  display_for_field,
 @@ -99,10 +100,15 @@ def result_headers(cl):
  # if the field is the action checkbox: no sorting and special
 class
  if field_name == "action_checkbox":
  aria_label = _("Select all objects on this page for an
 action")
 +widget = CheckboxInput(
 +attrs={
 +"aria-label": aria_label,
 +"id": "action-toggle",
 +}
 +)
  yield {
  "text": mark_safe(
 -f''
 +widget.render(name="action-toggle", value=False)
  ),
  "class_attrib": mark_safe(' class="action-checkbox-
 column"'),
  "sortable": False,
 diff --git a/tests/admin_changelist/tests.py
 b/tests/admin_changelist/tests.py
 index bf85cf038f..bf6245ca1f 100644
 --- a/tests/admin_changelist/tests.py
 +++ b/tests/admin_changelist/tests.py
 @@ -359,7 +359,7 @@ class ChangeListTests(TestCase):
  "Failed to find expected row element: %s" % table_output,
  )
  self.assertInHTML(
 -'',
  table_output,
  )
 }}}
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018f5ed1d840-d8232777-0714-4c94-8ba8-51e869daf659-00%40eu-central-1.amazonses.com.


Re: [Django] #35326: OverwritingStorageTests fail if a TemporaryUploadedFile is used

2024-05-09 Thread Django
#35326: OverwritingStorageTests fail if a TemporaryUploadedFile is used
--+
 Reporter:  bcail |Owner:  bcail
 Type:  Bug   |   Status:  assigned
Component:  File uploads/storage  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by bcail):

 * needs_better_patch:  1 => 0

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018f5e92a03e-12d259b9-4a11-48af-bed0-190ec1ba9883-00%40eu-central-1.amazonses.com.


Re: [Django] #35404: Admin fieldset multiple flexbox regressions

2024-05-09 Thread Django
#35404: Admin fieldset multiple flexbox regressions
+
 Reporter:  minusf  |Owner:  nobody
 Type:  Bug |   Status:  new
Component:  contrib.admin   |  Version:  4.2
 Severity:  Normal  |   Resolution:
 Keywords:  css admin fieldset  | Triage Stage:  Accepted
Has patch:  1   |  Needs documentation:  0
  Needs tests:  0   |  Patch needs improvement:  0
Easy pickings:  0   |UI/UX:  1
+
Changes (by minusf):

 * has_patch:  0 => 1

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018f5e3b79ea-07ed3330-88bc-40e1-b744-ea9343602d65-00%40eu-central-1.amazonses.com.


Re: [Django] #35404: Admin fieldset multiple flexbox regressions

2024-05-09 Thread Django
#35404: Admin fieldset multiple flexbox regressions
+
 Reporter:  minusf  |Owner:  nobody
 Type:  Bug |   Status:  new
Component:  contrib.admin   |  Version:  4.2
 Severity:  Normal  |   Resolution:
 Keywords:  css admin fieldset  | Triage Stage:  Accepted
Has patch:  0   |  Needs documentation:  0
  Needs tests:  0   |  Patch needs improvement:  0
Easy pickings:  0   |UI/UX:  1
+
Comment (by minusf):

 Replying to [comment:6 Sarah Boyce]:
 > In case I was misunderstood, for the css we were looking at `line-
 height: 1;` was overriding an existing larger line-height. Generally, I
 would like our css have good defaults and not have too much being
 overriden for particular classes/elements.

 Yes, I see what you mean. Removing it sets `line-height: normal` (by user
 agent), which according to mdn is "a default value of roughly 1.2,
 depending on the element's font-family"...

 https://github.com/django/django/pull/18151
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018f5e3b45b8-1cc2127b-6de4-41cb-ad3a-eedfc0210ba0-00%40eu-central-1.amazonses.com.


Re: [Django] #35401: Document the `conditional_page` decorator

2024-05-09 Thread Django
#35401: Document the `conditional_page` decorator
-+-
 Reporter:  Keryn Knight |Owner:  Lufafa
 Type:   |  Joshua
  Cleanup/optimization   |   Status:  assigned
Component:  Documentation|  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Lufafa Joshua):

 * has_patch:  0 => 1

Comment:

 [https://github.com/django/django/pull/18150 PR]
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018f5cb5d6a5-579d7da6-4cd4-4036-81b4-fbab46819a7f-00%40eu-central-1.amazonses.com.


Re: [Django] #35440: Update parse_header_parameters to leverage the parsing logic from (stdlib) email Message.

2024-05-09 Thread Django
#35440: Update parse_header_parameters to leverage the parsing logic from 
(stdlib)
email Message.
--+
 Reporter:  Natalia Bidart|Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  HTTP handling |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by David Smith):

 * stage:  Unreviewed => Accepted

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018f5c06c5fd-903bc8eb-54b1-48a3-8963-6bc30f88da64-00%40eu-central-1.amazonses.com.


Re: [Django] #35439: Hardcoded HTML in python code.

2024-05-09 Thread Django
#35439: Hardcoded HTML in python code.
-+-
 Reporter:  sesostris|Owner:  nobody
 Type:   |   Status:  closed
  Cleanup/optimization   |
Component:  contrib.admin|  Version:  5.0
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by David Smith):

 * resolution:   => wontfix
 * status:  new => closed

Comment:

 Thank you for the ticket.

 I'm not sure it's worth changing as there are test failures with this
 change so it is not equivalent. The ticket mentions that using a widget
 would be better but I'm unsure why using a widget and rending the HTML
 using the template engine would be better in this particular case.
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018f5c0583f1-77a019a8-9580-4b1a-894a-847082212be1-00%40eu-central-1.amazonses.com.