#35395: Python 3.12 filter bug with Django 4.2.11
---------------------------------+--------------------------------------
     Reporter:  Tim Richardson   |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  Template system  |                  Version:  4.2
     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 Tim Richardson:

Old description:

> I have a template with a fragment like this:
>

> <span
>                             class="fs-6">Supplier: {{
> po_metadata|get_item:dict_item.PONumber|get_item:"supplier" }} PO Date:
> {{ po_metadata|get_item:dict_item.PONumber|get_item:"order_date" |
> slice:":10" }} </span>
>

> When using python 3.13.2, I get an exception in
> django/template/defaultfilters.py  slice_filter()
>
> This code does throw an exception with 3.11
>
> The exception is a Key Error and it happens because instead a list being
> passed to the filter, a dictionary is. An empty dict in my case.
>
> In python 3.11, the breakpoints  in slice_filter() are not hit. Somehow
> the preceeding filters are behaving differently in case of po_metadata
> being an empty  dict.

New description:

 I have a template with a fragment like this:


 <span
                             class="fs-6">Supplier: {{
 po_metadata|get_item:dict_item.PONumber|get_item:"supplier" }} PO Date: {{
 po_metadata|get_item:dict_item.PONumber|get_item:"order_date" |
 slice:":10" }} </span>


 When using python 3.13.2, I get an exception in
 django/template/defaultfilters.py  slice_filter()

 This code does not throw an exception with 3.11

 The exception is a Key Error and it happens because instead a list being
 passed to the filter, a dictionary is. An empty dict in my case.

 In python 3.11, the breakpoints  in slice_filter() are not hit. Somehow
 the preceeding filters are behaving differently in case of po_metadata
 being an empty  dict.

--
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35395#comment:1>
Django <https://code.djangoproject.com/>
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/0107018f04ee5484-4330caf2-817e-40b0-9aa6-6c09828e3e94-000000%40eu-central-1.amazonses.com.

Reply via email to