#35735: For python 3.9+ class property may not be accessible by Django's 
template
system
---------------------------------+----------------------------------------
     Reporter:  Fabian Braun     |                    Owner:  Fabian Braun
         Type:  Bug              |                   Status:  assigned
    Component:  Template system  |                  Version:  5.0
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Unreviewed
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+----------------------------------------
Comment (by Natalia Bidart):

 Hi Fabian, thank you for taking the time to create this report!

 (Before your last edit) I have tried to reproduce the issue described and
 I wasn't able to, I then analyzed your test and noticed that in the test
 (but not in the ticket description) `MyClass` is a child of `list`. For
 that case, and for children of `dict` or `set`, the test indeed fail; but
 for children of `object`, `str`, `int`, the test do not fail.

 So on one hand, the issues seems less generic than presented in the title
 and description. On the other hand, I'm not sure what you mean with:

 > As of python 3.9 some classes actually are subscriptable

 My first thought is that your `MyClass` is subscriptable because it's a
 child of `list`... so I'm having a hard time understanding how Django is
 at fault here. Could you please elaborate?

 Also for this sentence:

 > I'd be happy to propose a fix that will not call a classes'
 `__class_getitem__` method.

 I have grepped all the Django source code and nothing other than a few
 classes in the ORM implement `__class_getitem__`, so what do you mean
 exactly?

 {{{
 $ grep -nR __class_getitem__
 django/db/models/fields/related.py:999:    def __class_getitem__(cls,
 *args, **kwargs):
 django/db/models/manager.py:39:    def __class_getitem__(cls, *args,
 **kwargs):
 django/db/models/query.py:435:    def __class_getitem__(cls, *args,
 **kwargs):
 }}}

 I'm closing as `needsinfo`  but please reopen when you can provide further
 clarifications. Thanks again!
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35735#comment:5>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070191c3836769-621e2ed6-1b21-4d45-9107-d61b70a6b163-000000%40eu-central-1.amazonses.com.

Reply via email to