Re: [Django] #35417: RequestContext.new creates a context that cannot be flattened

2024-06-14 Thread Django
#35417: RequestContext.new creates a context that cannot be flattened
-+-
 Reporter:  Lily Foote   |Owner:  George
 |  Kussumoto
 Type:  Bug  |   Status:  closed
Component:  Template system  |  Version:  5.0
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Sarah Boyce <42296566+sarahboyce@…>):

 In [changeset:"64443f555f362ddf0c9094f8531c3da72a753827" 64443f5]:
 {{{#!CommitTicketReference repository=""
 revision="64443f555f362ddf0c9094f8531c3da72a753827"
 [5.1.x] Fixed #35417 -- Updated BaseContext.new() with values to create a
 context that can be flattened.

 Backport of 2a32b233822683c51e59722b7c9aa0789fc4ab1b from main.
 }}}
-- 
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/0107019016b3018b-df0b2c1f-d761-4dd8-9916-bc7a25445e90-00%40eu-central-1.amazonses.com.


Re: [Django] #35417: RequestContext.new creates a context that cannot be flattened

2024-06-13 Thread Django
#35417: RequestContext.new creates a context that cannot be flattened
-+-
 Reporter:  Lily Foote   |Owner:  George
 |  Kussumoto
 Type:  Bug  |   Status:  closed
Component:  Template system  |  Version:  5.0
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Sarah Boyce <42296566+sarahboyce@…>):

 * resolution:   => fixed
 * status:  assigned => closed

Comment:

 In [changeset:"2a32b233822683c51e59722b7c9aa0789fc4ab1b" 2a32b233]:
 {{{#!CommitTicketReference repository=""
 revision="2a32b233822683c51e59722b7c9aa0789fc4ab1b"
 Fixed #35417 -- Updated BaseContext.new() with values to create a context
 that can be flattened.
 }}}
-- 
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/01070190118d0a7e-5d04782a-a43b-4a9c-8764-2a0310d0a25a-00%40eu-central-1.amazonses.com.


Re: [Django] #35417: RequestContext.new creates a context that cannot be flattened

2024-06-13 Thread Django
#35417: RequestContext.new creates a context that cannot be flattened
-+-
 Reporter:  Lily Foote   |Owner:  George
 |  Kussumoto
 Type:  Bug  |   Status:  assigned
Component:  Template system  |  Version:  5.0
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Sarah Boyce):

 * stage:  Accepted => Ready for checkin

Comment:

 Replying to [comment:6 George Kussumoto]:
 > Hi, it's my first contribution here, so let me know if I failed to
 follow the guidelines.

 You did great 🥳
-- 
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/0107019010f48595-88e2692d-3e74-4d66-90c6-5bd4a8ca088e-00%40eu-central-1.amazonses.com.


Re: [Django] #35417: RequestContext.new creates a context that cannot be flattened

2024-06-04 Thread Django
#35417: RequestContext.new creates a context that cannot be flattened
-+-
 Reporter:  Lily Foote   |Owner:  George
 |  Kussumoto
 Type:  Bug  |   Status:  assigned
Component:  Template system  |  Version:  5.0
 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 George Kussumoto):

 * has_patch:  0 => 1

Comment:

 PR: https://github.com/django/django/pull/18221

 Hi, it's my first contribution here, so let me know if I failed to follow
 the guidelines.
-- 
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/0107018fe4bf6232-b0cf6eb8-07a1-4798-acac-f90ec9632e64-00%40eu-central-1.amazonses.com.


Re: [Django] #35417: RequestContext.new creates a context that cannot be flattened

2024-06-03 Thread Django
#35417: RequestContext.new creates a context that cannot be flattened
-+-
 Reporter:  Lily Foote   |Owner:  George
 |  Kussumoto
 Type:  Bug  |   Status:  assigned
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 George Kussumoto):

 * owner:  nobody => George Kussumoto
 * status:  new => assigned

-- 
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/0107018fe0287008-b3a2f73f-8dca-47f3-8555-6ac86a699387-00%40eu-central-1.amazonses.com.


Re: [Django] #35417: RequestContext.new creates a context that cannot be flattened

2024-05-02 Thread Django
#35417: RequestContext.new creates a context that cannot be flattened
-+
 Reporter:  Lily Foote   |Owner:  nobody
 Type:  Bug  |   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 Sarah Boyce):

 * component:  Uncategorized => Template system

-- 
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/0107018f384dfab3-6b768a71-65ba-4b19-ab85-998c2cf651bd-00%40eu-central-1.amazonses.com.


Re: [Django] #35417: RequestContext.new creates a context that cannot be flattened

2024-05-02 Thread Django
#35417: RequestContext.new creates a context that cannot be flattened
---+
 Reporter:  Lily Foote |Owner:  nobody
 Type:  Bug|   Status:  new
Component:  Uncategorized  |  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 Sarah Boyce):

 * stage:  Unreviewed => Accepted
 * type:  Uncategorized => Bug

Comment:

 Replicated (thank you for the test case) and also confirmed `Context` and
 `RenderContext`, 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/0107018f384a6de5-fa6eb655-62bb-4b58-a203-f886e7b733c9-00%40eu-central-1.amazonses.com.


Re: [Django] #35417: RequestContext.new creates a context that cannot be flattened

2024-04-30 Thread Django
#35417: RequestContext.new creates a context that cannot be flattened
---+--
 Reporter:  Lily Foote |Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Uncategorized  |  Version:  5.0
 Severity:  Normal |   Resolution:
 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 Lily Foote):

 Investigating a bit more, this also applies to {{{Context}}} and
 {{{RenderContext}}}.
-- 
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/0107018f303b59b6-818a2b94-657d-4ef0-a907-e5c1f8a2d95a-00%40eu-central-1.amazonses.com.


Re: [Django] #35417: RequestContext.new creates a context that cannot be flattened

2024-04-30 Thread Django
#35417: RequestContext.new creates a context that cannot be flattened
---+--
 Reporter:  Lily Foote |Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Uncategorized  |  Version:  5.0
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--
Description changed by Lily Foote:

Old description:

> In
> [https://github.com/django/django/blob/c187f5f9242b681abaa199173e02066997439425/django/template/library.py#L273
> InclusionNode.render] Django creates a {{{new_context}}} from two
> existing contexts ({{{context}}} and {{{_dict}}}) by calling
> {{{new_context = context.new(_dict)}}}. These can both be instances of
> {{{RequestContext}}} leading to {{{new_context}}} also being a
> {{{RequestContext}}} (I have not tried with any other context types).
> However, calling {{{new_context.flatten()}}} raises a {{{ValueError}}}:
>
> {{{
> ValueError: dictionary update sequence element #0 has length 1; 2 is
> required
> }}}
>
> I can reproduce this in a small test:
>
> {{{
> from django.template.context import RequestContext
> from django.test import RequestFactory, TestCase
>

> class RequestContextTestCase(TestCase):
> def test_flatten_request_context_new(self):
> factory = RequestFactory()
>
> request = factory.get("/foo/")
> context = RequestContext(request)
> context_2 = RequestContext(request)
> context_3 = context.new(context_2)
>
> self.assertEqual(
> context_3.flatten(), {"False": False, "None": None, "True":
> True}
> )
> }}}
>
> I discovered this when running Kolo on a Django admin view
> (http://127.0.0.1:8000/admin/auth/user/). Kolo calls
> {{{context.flatten()}}} internally when introspecting a template during
> rendering, which leads to this exception:
>
> {{{
> Traceback (most recent call last):
>   File
> "/home/lily/work/kloppindustries/kolo/python/src/kolo/profiler.py", line
> 170, in __call__
> frame_data = processor.process(
>  ^^
>   File "/home/lily/work/kloppindustries/kolo/python/src/kolo/plugins.py",
> line 107, in process
> data.update(self.process_extra(frame, event, arg, self.context))
> ^^^
>   File
> "/home/lily/work/kloppindustries/kolo/python/src/kolo/filters/django.py",
> line 89, in process_django_template
> template_context = template_context.flatten()
>^^
>   File "/home/lily/.local/share/lilyenv/virtualenvs/kolo-
> sandbox/3.12/lib/python3.12/site-packages/django/template/context.py",
> line 120, in flatten
> flat.update(d)
> ValueError: dictionary update sequence element #0 has length 3; 2 is
> required
> }}}

New description:

 In
 
[https://github.com/django/django/blob/c187f5f9242b681abaa199173e02066997439425/django/template/library.py#L273
 InclusionNode.render] Django creates a {{{new_context}}} from two existing
 contexts ({{{context}}} and {{{_dict}}}) by calling {{{new_context =
 context.new(_dict)}}}. These can both be instances of {{{RequestContext}}}
 leading to {{{new_context}}} also being a {{{RequestContext}}} (I have not
 tried with any other context types). However, calling
 {{{new_context.flatten()}}} raises a {{{ValueError}}}:

 {{{
 ValueError: dictionary update sequence element #0 has length 1; 2 is
 required
 }}}

 I can reproduce this in a small test:

 {{{
 from django.template.context import RequestContext
 from django.test import RequestFactory, TestCase


 class RequestContextTestCase(TestCase):
 def test_flatten_request_context_new(self):
 factory = RequestFactory()

 request = factory.get("/foo/")
 context = RequestContext(request)
 context_2 = RequestContext(request)
 context_3 = context.new(context_2)

 self.assertEqual(
 context_3.flatten(), {"False": False, "None": None, "True":
 True}
 )
 }}}

 I discovered this when running Kolo on a Django admin view
 (http://127.0.0.1:8000/admin/auth/user/). Kolo calls
 {{{context.flatten()}}} internally when introspecting a template during
 rendering, which leads to this exception:

 {{{
 Traceback (most recent call last):
   File "/home/lily/work/kloppindustries/kolo/python/src/kolo/profiler.py",
 line 170, in __call__
 frame_data = processor.process(
  ^^
   File "/home/lily/work/kloppindustries/kolo/python/src/kolo/plugins.py",
 line 107, in process
 data.update(self.process_extra(frame, event, arg

[Django] #35417: RequestContext.new creates a context that cannot be flattened

2024-04-30 Thread Django
#35417: RequestContext.new creates a context that cannot be flattened
-+
   Reporter:  Lily Foote |  Owner:  nobody
   Type:  Uncategorized  | Status:  new
  Component:  Uncategorized  |Version:  5.0
   Severity:  Normal |   Keywords:
   Triage Stage:  Unreviewed |  Has patch:  0
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+
 In
 
[https://github.com/django/django/blob/c187f5f9242b681abaa199173e02066997439425/django/template/library.py#L273
 InclusionNode.render] Django creates a {{{new_context}}} from two existing
 contexts ({{{context}}} and {{{_dict}}}) by calling {{{new_context =
 context.new(_dict)}}}. These can both be instances of {{{RequestContext}}}
 leading to {{{new_context}}} also being a {{{RequestContext}}} (I have not
 tried with any other context types). However, calling
 {{{new_context.flatten()}}} raises a {{{ValueError}}}:

 {{{
 ValueError: dictionary update sequence element #0 has length 1; 2 is
 required
 }}}

 I can reproduce this in a small test:

 {{{
 from django.template.context import RequestContext
 from django.test import RequestFactory, TestCase


 class RequestContextTestCase(TestCase):
 def test_flatten_request_context_new(self):
 factory = RequestFactory()

 request = factory.get("/foo/")
 context = RequestContext(request)
 context_2 = RequestContext(request)
 context_3 = context.new(context_2)

 self.assertEqual(
 context_3.flatten(), {"False": False, "None": None, "True":
 True}
 )
 }}}

 I discovered this when running Kolo on a Django admin view
 (http://127.0.0.1:8000/admin/auth/user/). Kolo calls
 {{{context.flatten()}}} internally when introspecting a template during
 rendering, which leads to this exception:

 {{{
 Traceback (most recent call last):
   File "/home/lily/work/kloppindustries/kolo/python/src/kolo/profiler.py",
 line 170, in __call__
 frame_data = processor.process(
  ^^
   File "/home/lily/work/kloppindustries/kolo/python/src/kolo/plugins.py",
 line 107, in process
 data.update(self.process_extra(frame, event, arg, self.context))
 ^^^
   File
 "/home/lily/work/kloppindustries/kolo/python/src/kolo/filters/django.py",
 line 89, in process_django_template
 template_context = template_context.flatten()
^^
   File "/home/lily/.local/share/lilyenv/virtualenvs/kolo-
 sandbox/3.12/lib/python3.12/site-packages/django/template/context.py",
 line 120, in flatten
 flat.update(d)
 ValueError: dictionary update sequence element #0 has length 3; 2 is
 required
 }}}
-- 
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/0107018f2f8b2174-0d33b315-bbe2-4ea2-a2eb-40f7e4c1be6f-00%40eu-central-1.amazonses.com.