Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#25466 closed Bug (fixed)

django.template.loader.LoaderOrigin was removed without proper deprecation

Reported by: Joey Wilhelm Owned by: nobody
Component: Template system Version: 1.9a1
Severity: Release blocker Keywords:
Cc: Florian Apolloner Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

#15053 caused the removal of django.template.loader.LoadOrigin (and django.template.StringOrigin), in favor of django.template.base.Origin, for Django 1.9.

These APIs were new and documented as of Django 1.7: https://docs.djangoproject.com/en/1.7/ref/templates/api/#template-origin

Even in the 1.8 branch, there is no DeprecationWarning for this class: https://github.com/django/django/blob/stable/1.8.x/django/template/loader.py#L14

Attachments (1)

25466-aliases.diff (1.0 KB) - added by Tim Graham 7 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 7 years ago by Florian Apolloner

Cc: Florian Apolloner added
Severity: NormalRelease blocker

If possible we should restore the old aliases, after all this is a regression.

comment:2 Changed 7 years ago by Florian Apolloner

Triage Stage: UnreviewedAccepted

comment:3 Changed 7 years ago by Tim Graham

Description: modified (diff)

May I ask about the use case so we can be sure to solve the issue appropriately? Thanks.

comment:4 Changed 7 years ago by Joey Wilhelm

The case where I found it was in https://github.com/opbeat/opbeat_python/blob/131ecaa4829fa3155020e3f2c39c382fd1f8a08e/opbeat/contrib/django/client.py#L148. According to piquadrat, in #django:

< piquadrat> TheJoey: yep, that's probably the way it'll go. BTW, generally speaking, the change that introduced this is actually great for Opbeat because we now have the template name and can show you the template in the stack trace

Changed 7 years ago by Tim Graham

Attachment: 25466-aliases.diff added

comment:5 Changed 7 years ago by Tim Graham

Would the attached patch solve your issue? A formal deprecation doesn't seem possible since you don't instantiate the class.

comment:6 Changed 7 years ago by Benjamin Wohlwend

In the case of opbeat_python, it would solve the problem, but we anyway intend to use the Origin class when available.

I searched github for LoaderOrigin, there are a few occurrences, most prominently raven-python (Sentry), which is already updated to work with 1.9a1.

comment:7 Changed 7 years ago by Tim Graham

Has patch: set

comment:8 Changed 7 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In 8d1a001:

Fixed #25466 -- Added backwards compatibility aliases for LoaderOrigin and StringOrigin.

Thanks Simon Charette for the DeprecationInstanceCheck class.

comment:9 Changed 7 years ago by Tim Graham <timograham@…>

In 59027a4c:

[1.9.x] Fixed #25466 -- Added backwards compatibility aliases for LoaderOrigin and StringOrigin.

Thanks Simon Charette for the DeprecationInstanceCheck class.

Backport of 8d1a001ef6dcbbe8053da05cdb3ec99965b0953f from master

comment:10 Changed 6 years ago by Tim Graham <timograham@…>

In ff419de2:

Refs #25466 -- Removed aliases for LoaderOrigin and StringOrigin.

Per deprecation timeline.

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