[Django] #31701: Extend DeferredAttribute & Remove unnecessary overriding of contrib_to_class () in FileField

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[Django] #31701: Extend DeferredAttribute & Remove unnecessary overriding of contrib_to_class () in FileField

Django
#31701: Extend DeferredAttribute  & Remove unnecessary overriding of
contrib_to_class () in FileField
-------------------------------------+-------------------------------------
               Reporter:  Sultan     |          Owner:  nobody
                   Type:             |         Status:  new
  Cleanup/optimization               |
              Component:  Database   |        Version:  3.1
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  1
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  1
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 The model fields use, by default, the descriptor **DeferredAttribute** to
 access and process (if necessary) the data associated with them. This type
 of data represents the actual data in db column. I prefer to call it a
 “field data”.

 To access the field data in instance dict, **Field.attname** is used as a
 key.

 In addition to the field data, some other model fields (for example, FK)
 also use a "client data" of the attribute, the processing of which is
 performed by a particular descriptor. Such a descriptor is usually
 assigned to a model using **Field.name**.

 This enables us to process and present data in different ways:
 article.author returns a User object, and article.auther_id returns a User
 object pk.

 This feature is not used in model.FileField. Then why use FileField.name
 instead of FileField.attname for FileDescriptor?

 I think it would be better if FileDescriptor uses field.attname and
 continue working with the DeferredAttribute class.

--
Ticket URL: <https://code.djangoproject.com/ticket/31701>
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/052.8f9665437c36127ed0ace9f6f5122274%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #31701: Extend DeferredAttribute & Remove unnecessary overriding of contrib_to_class () in FileField

Django
#31701: Extend DeferredAttribute  & Remove unnecessary overriding of
contrib_to_class () in FileField
-------------------------------------+-------------------------------------
     Reporter:  Sultan               |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  3.1
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Sultan:

Old description:

> The model fields use, by default, the descriptor **DeferredAttribute** to
> access and process (if necessary) the data associated with them. This
> type of data represents the actual data in db column. I prefer to call it
> a “field data”.
>
> To access the field data in instance dict, **Field.attname** is used as a
> key.
>
> In addition to the field data, some other model fields (for example, FK)
> also use a "client data" of the attribute, the processing of which is
> performed by a particular descriptor. Such a descriptor is usually
> assigned to a model using **Field.name**.
>
> This enables us to process and present data in different ways:
> article.author returns a User object, and article.auther_id returns a
> User object pk.
>
> This feature is not used in model.FileField. Then why use FileField.name
> instead of FileField.attname for FileDescriptor?
>
> I think it would be better if FileDescriptor uses field.attname and
> continue working with the DeferredAttribute class.
New description:

 The model fields use, by default, the descriptor **DeferredAttribute** to
 access and process (if necessary) the data associated with them. This type
 of data represents the actual data in db column. I prefer to call it a
 “field data”.

 To access the field data in instance dict, **Field.attname** is used as a
 key.

 In addition to the field data, some other model fields (for example,
 ForeignKey) also use a "client data" of the attribute, the processing of
 which is performed by a particular descriptor. Such a descriptor is
 usually assigned to a model using **Field.name**.

 This enables us to process and present data in different ways:
 article.author returns a User object, and article.auther_id returns a User
 object pk.

 This feature is not used in model.FileField. Then why use FileField.name
 instead of FileField.attname for FileDescriptor?

 I think it would be better if FileDescriptor uses field.attname and
 continue working with the DeferredAttribute class.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/31701#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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.08a0a1889c2bac91a3b3a7dcb3742161%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #31701: Extend DeferredAttribute & Remove unnecessary overriding of contrib_to_class () in FileField

Django
In reply to this post by Django
#31701: Extend DeferredAttribute  & Remove unnecessary overriding of
contrib_to_class () in FileField
-------------------------------------+-------------------------------------
     Reporter:  Sultan               |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Sultan):

 * version:  3.1 => master


Old description:

> The model fields use, by default, the descriptor **DeferredAttribute** to
> access and process (if necessary) the data associated with them. This
> type of data represents the actual data in db column. I prefer to call it
> a “field data”.
>
> To access the field data in instance dict, **Field.attname** is used as a
> key.
>
> In addition to the field data, some other model fields (for example,
> ForeignKey) also use a "client data" of the attribute, the processing of
> which is performed by a particular descriptor. Such a descriptor is
> usually assigned to a model using **Field.name**.
>
> This enables us to process and present data in different ways:
> article.author returns a User object, and article.auther_id returns a
> User object pk.
>
> This feature is not used in model.FileField. Then why use FileField.name
> instead of FileField.attname for FileDescriptor?
>
> I think it would be better if FileDescriptor uses field.attname and
> continue working with the DeferredAttribute class.
New description:

 The model fields use, by default, the descriptor **DeferredAttribute** to
 access and process (if necessary) the data associated with them. This type
 of data represents the actual data in db column. I prefer to call it a
 “field data”.

 To access the field data in instance dict, **Field.attname** is used as a
 key.

 In addition to the field data, some other model fields (for example,
 ForeignKey) also use a "client data" of the attribute, the processing of
 which is performed by a particular descriptor. Such a descriptor is
 usually assigned to a model using **Field.name**.

 This enables us to process and present the data in different ways:
 article.author returns a User object, and article.auther_id returns a User
 object pk.

 This feature is not used in model.FileField. Then why use FileField.name
 instead of FileField.attname for FileDescriptor?

 I think it would be better if FileDescriptor uses field.attname and
 continue working with the DeferredAttribute class.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/31701#comment:2>
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.4ca89bb060dbf341a2155967834e1a5e%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #31701: Extend DeferredAttribute & Remove unnecessary FileField.contrib_to_class () (was: Extend DeferredAttribute & Remove unnecessary overriding of contrib_to_class () in FileField)

Django
In reply to this post by Django
#31701: Extend DeferredAttribute  & Remove unnecessary FileField.contrib_to_class
()
-------------------------------------+-------------------------------------
     Reporter:  Sultan               |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Sultan:

Old description:

> The model fields use, by default, the descriptor **DeferredAttribute** to
> access and process (if necessary) the data associated with them. This
> type of data represents the actual data in db column. I prefer to call it
> a “field data”.
>
> To access the field data in instance dict, **Field.attname** is used as a
> key.
>
> In addition to the field data, some other model fields (for example,
> ForeignKey) also use a "client data" of the attribute, the processing of
> which is performed by a particular descriptor. Such a descriptor is
> usually assigned to a model using **Field.name**.
>
> This enables us to process and present the data in different ways:
> article.author returns a User object, and article.auther_id returns a
> User object pk.
>
> This feature is not used in model.FileField. Then why use FileField.name
> instead of FileField.attname for FileDescriptor?
>
> I think it would be better if FileDescriptor uses field.attname and
> continue working with the DeferredAttribute class.
New description:

 The model fields use, by default, the descriptor **DeferredAttribute** to
 access and process (if necessary) the data associated with them. This type
 of data represents the actual data in db column. I prefer to call it a
 “field data”.

 To access the field data in instance dict, **Field.attname** is used as a
 key.

 In addition to the field data, some other model fields (for example,
 ForeignKey) also use a "client data" of the attribute, the processing of
 which is performed by a particular descriptor. Such a descriptor is
 usually assigned to a model using **Field.name**. Its task is to present
 the same field data in a different format, the result of which differs
 from the result of Field.attname descriptor: `article.author` returns a
 User object, and `article.auther_id` returns a User object pk.
 This feature is not used in FileField. Then why use FileField.name instead
 of FileField.attname for FileDescriptor?

 I think it would be better if FileDescriptor uses FileField.attname and
 continue working with the DeferredAttribute class.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/31701#comment:3>
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.aed54b05f8e5b445aa7ebf7dad287e4d%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #31701: Extend DeferredAttribute & Remove unnecessary FileField.contrib_to_class ()

Django
In reply to this post by Django
#31701: Extend DeferredAttribute  & Remove unnecessary FileField.contrib_to_class
()
-------------------------------------+-------------------------------------
     Reporter:  Sultan               |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Sultan:

Old description:

> The model fields use, by default, the descriptor **DeferredAttribute** to
> access and process (if necessary) the data associated with them. This
> type of data represents the actual data in db column. I prefer to call it
> a “field data”.
>
> To access the field data in instance dict, **Field.attname** is used as a
> key.
>
> In addition to the field data, some other model fields (for example,
> ForeignKey) also use a "client data" of the attribute, the processing of
> which is performed by a particular descriptor. Such a descriptor is
> usually assigned to a model using **Field.name**. Its task is to present
> the same field data in a different format, the result of which differs
> from the result of Field.attname descriptor: `article.author` returns a
> User object, and `article.auther_id` returns a User object pk.
> This feature is not used in FileField. Then why use FileField.name
> instead of FileField.attname for FileDescriptor?
>
> I think it would be better if FileDescriptor uses FileField.attname and
> continue working with the DeferredAttribute class.
New description:

 The model fields use, by default, the descriptor **DeferredAttribute** to
 access and process (if necessary) the data associated with them. This type
 of data represents the actual data in db column. I prefer to call it a
 “field data”.

 To access the field data in instance dict, **Field.attname** is used as a
 key.

 In addition to the field data, some other model fields (for example,
 ForeignKey) also use a "client data" of the attribute, the processing of
 which is performed by a particular descriptor. Such a descriptor is
 assigned to a model using **Field.name**. Its task is to present the same
 field data in a different format, the result of which differs from the
 result of Field.attname descriptor: `article.author` returns a User
 object, and `article.auther_id` returns a User object pk.

 This feature is not used in FileField. Then why use FileField.name instead
 of FileField.attname for FileDescriptor?

 I think it would be better if FileDescriptor uses FileField.attname and
 continue working with the DeferredAttribute class.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/31701#comment:4>
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.452955758bec34a3d637c8577ecb48cd%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #31701: Extend DeferredAttribute & Remove unnecessary FileField.contrib_to_class ()

Django
In reply to this post by Django
#31701: Extend DeferredAttribute  & Remove unnecessary FileField.contrib_to_class
()
-------------------------------------+-------------------------------------
     Reporter:  Sultan               |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Sultan:

Old description:

> The model fields use, by default, the descriptor **DeferredAttribute** to
> access and process (if necessary) the data associated with them. This
> type of data represents the actual data in db column. I prefer to call it
> a “field data”.
>
> To access the field data in instance dict, **Field.attname** is used as a
> key.
>
> In addition to the field data, some other model fields (for example,
> ForeignKey) also use a "client data" of the attribute, the processing of
> which is performed by a particular descriptor. Such a descriptor is
> assigned to a model using **Field.name**. Its task is to present the same
> field data in a different format, the result of which differs from the
> result of Field.attname descriptor: `article.author` returns a User
> object, and `article.auther_id` returns a User object pk.
>
> This feature is not used in FileField. Then why use FileField.name
> instead of FileField.attname for FileDescriptor?
>
> I think it would be better if FileDescriptor uses FileField.attname and
> continue working with the DeferredAttribute class.
New description:

 The model fields use, by default, the descriptor **DeferredAttribute** to
 access and process (if necessary) the data associated with them. This type
 of data represents the actual data in db column. I prefer to call it a
 “field data”.

 To access the field data in instance dict, **Field.attname** is used as a
 key.

 In addition to the field data, some other model fields (for example,
 ForeignKey) also use a "client data" of the attribute, the processing of
 which is performed by a particular descriptor. Such a descriptor is
 assigned to a model using **Field.name**. Its task is to present the same
 field data in a different format, the result of which differs from the
 result of Field.attname descriptor: `article.author` returns a User
 object, and `article.auther_id` returns a User object pk.

 This feature is not used in FileField. Then why use FileField.name instead
 of FileField.attname for FileDescriptor?

 I think it would be better if FileDescriptor extends the DeferredAttribute
 class and uses `field.attname` instead of `field.name`.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/31701#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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.b91cf73e9e84d36223e4bf8fad4d0a02%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #31701: Make FileDescriptor subclass DeferredAttribute. (was: Extend DeferredAttribute & Remove unnecessary FileField.contrib_to_class ())

Django
In reply to this post by Django
#31701: Make FileDescriptor subclass DeferredAttribute.
-------------------------------------+-------------------------------------
     Reporter:  Sultan               |                    Owner:  Sultan
         Type:                       |                   Status:  assigned
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by felixxm):

 * owner:  nobody => Sultan
 * status:  new => assigned
 * stage:  Unreviewed => Accepted


Comment:

 Looks reasonable.

--
Ticket URL: <https://code.djangoproject.com/ticket/31701#comment:6>
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.f37b6ff88e1d8e61807a6ecef4cfd8f3%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #31701: Make FileDescriptor subclass DeferredAttribute.

Django
In reply to this post by Django
#31701: Make FileDescriptor subclass DeferredAttribute.
-------------------------------------+-------------------------------------
     Reporter:  Sultan               |                    Owner:  Sultan
         Type:                       |                   Status:  assigned
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Sultan):

 Replying to [comment:6 felixxm]: It's much better. Thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/31701#comment:7>
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.4045bfb35aa45cebe949627b6234f71e%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #31701: Make FileDescriptor subclass DeferredAttribute.

Django
In reply to this post by Django
#31701: Make FileDescriptor subclass DeferredAttribute.
-------------------------------------+-------------------------------------
     Reporter:  Sultan               |                    Owner:  Sultan
         Type:                       |                   Status:  assigned
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by felixxm):

 * stage:  Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/31701#comment:8>
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.0dd42c0b0511e98f10ab5e93ff76a857%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #31701: Make FileDescriptor subclass DeferredAttribute.

Django
In reply to this post by Django
#31701: Make FileDescriptor subclass DeferredAttribute.
-------------------------------------+-------------------------------------
     Reporter:  Sultan               |                    Owner:  Sultan
         Type:                       |                   Status:  closed
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     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:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

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


Comment:

 In [changeset:"a93425a37f4defdb31d4ca96bb3bf6da21f0b5ce" a93425a]:
 {{{
 #!CommitTicketReference repository=""
 revision="a93425a37f4defdb31d4ca96bb3bf6da21f0b5ce"
 Fixed #31701 -- Made FileDescriptor subclass DeferredAttribute.
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31701#comment:9>
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.96d4379edb6b9de3cb2f5c27c482bfcd%40djangoproject.com.