Code

Opened 3 years ago

Closed 18 months 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 3 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 3 years ago.
Patch that implements the proposed change, test included

Download all attachments as: .zip

Change History (12)

Changed 3 years ago by tkolar

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

comment:1 Changed 3 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 3 years ago by russellm

  • Has patch set
  • Needs tests set
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

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 3 years ago by tkolar

Patch that implements the proposed change, test included

comment:3 Changed 3 years ago by tkolar

  • Cc tkolar added

Done ;)

comment:4 Changed 3 years ago by tkolar

  • Needs tests unset
  • Owner changed from nobody to tkolar
  • Patch needs improvement unset
  • Status changed from new to assigned

comment:5 Changed 3 years ago by jaddison

  • Severity set to Normal
  • Type set to Bug

comment:6 Changed 3 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 3 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 2 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:9 Changed 18 months ago by vicould

  • Cc ldelaveau@… added
  • Triage Stage changed from Accepted to Ready 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 18 months ago by apollo13

  • Resolution set to wontfix
  • Status changed from assigned to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.