Opened 6 years ago

Closed 4 years ago

#15098 closed Bug (wontfix)

SiteProfileNotAvailable needs silent_variable_failure=True

Reported by: tkolar Owned by: tkolar
Component: contrib.auth Version: master
Severity: Normal Keywords: SiteProfileNotAvailable silent_variable_failure
Cc: tkolar, ldelaveau@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

This makes sense in the context of #15097. If I understand this correctly, the problem from #15097 should exist in the dev version (because of the behavior detailed in the paragraph directly above http://docs.djangoproject.com/en/dev/ref/templates/api/#how-invalid-variables-are-handled). My guess is that this is exactly the type of thing that silent_variable_failure is there for, and SiteProfileNotAvailable does not have silent_variable_failure=True in SVN. I have attached a models.py that fixes this.

Attachments (2)

models.py (18.7 KB) - added by tkolar 6 years ago.
Version of models.py that sets django.contrib.auth.models.SiteProfileNotAvailable.silent_variable_failure=True
svft.diff (2.9 KB) - added by tkolar 6 years ago.
Patch that implements the proposed change, test included

Download all attachments as: .zip

Change History (12)

Changed 6 years ago by tkolar

Attachment: models.py added

Version of models.py that sets django.contrib.auth.models.SiteProfileNotAvailable.silent_variable_failure=True

comment:1 Changed 6 years ago by tkolar

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Sorry for the dead link in the file description - no idea how that happened.

comment:2 Changed 6 years ago by Russell Keith-Magee

Has patch: set
Needs tests: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

Seems like a reasonable suggestion. I can't think of any reason that get_profile should raise an exception during template rendering.

For future reference, please upload patches, rather than full files. Patches should also include tests to validate that the change does what it says.

Changed 6 years ago by tkolar

Attachment: svft.diff added

Patch that implements the proposed change, test included

comment:3 Changed 6 years ago by tkolar

Cc: tkolar added

Done ;)

comment:4 Changed 6 years ago by tkolar

Needs tests: unset
Owner: changed from nobody to tkolar
Patch needs improvement: unset
Status: newassigned

comment:5 Changed 5 years ago by James Addison

Severity: Normal
Type: Bug

comment:6 Changed 5 years ago by tkolar

Easy pickings: unset

Should the severity of this bug really be "normal"? If it isn't fixed, every template that does {{ user.get_profile.<some_field> }} will be broken if users do not necessarily have a profile. Besides, there is no other reliable way to get profile fields at all in the given situation without changing the view. Also, my patch fixes it already.

comment:7 Changed 5 years ago by tkolar

Easy pickings: set

And since all that anyone has to do with this patch to implement it is apply it, I set "easy pickings".

comment:8 Changed 5 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:9 Changed 4 years ago by Ludovic Delaveau

Cc: ldelaveau@… added
Triage Stage: AcceptedReady for checkin

Bumping the ticket, looks ready for checkin with respect to the previous discussion.
If needed, pull request is at https://github.com/django/django/pull/449

comment:10 Changed 4 years ago by Florian Apolloner

Resolution: wontfix
Status: assignedclosed

Django 1.5 will ship with a new method to add data to the user model and as such the current AUTH_PROFILE_MODULE is deprecated and will go away (including stuff like get_profile). As a result of the deprecation we won't fix any non critical bugs. Sry that we couldn't get this in earlier.

Note: See TracTickets for help on using tickets.
Back to Top