#21587: Make generic RedirectView default to permanent=False --------------------------------------+------------------------------------ Reporter: wraus@… | Owner: gregloy Type: Cleanup/optimization | Status: assigned Component: Generic views | Version: 1.6 Severity: Normal | Resolution: Keywords: redirect, view | Triage Stage: Accepted Has patch: 1 | Needs documentation: 1 Needs tests: 0 | Patch needs improvement: 1 Easy pickings: 0 | UI/UX: 0 --------------------------------------+------------------------------------ Changes (by bmispelon):
* needs_better_patch: 0 => 1 * easy: 1 => 0 Comment: As noted in the comment on the PR, the current approach would still raise a warning in this case: {{{#!python class CustomRedirectView(RedirectView): permanent = False }}} I think we could fix this with this approach: {{{#!python _sentinel = object() class RedirectView(View): permanent = _sentinel # empty objects evaluate to True ... def __init__(self, **kwargs): if 'permanent' not in kwargs and self.permanent is _sentinel: # raise deprecation warning ... }}} The tricky part then becomes writing a check for this (which is necessary at this point since we're making a subtle change to a default behavior) and I'm not sure exactly how to approach this. In any case, I'm removing the `easy pickings` flag. -- Ticket URL: <https://code.djangoproject.com/ticket/21587#comment:13> 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 post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/084.5ba3002781155e3c2f9286bc7fcb4c18%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.