Opened 8 years ago

Closed 8 years ago

#25825 closed Bug (fixed)

Template Origin is missing an __ne__ implementation

Reported by: Jaap Roes Owned by: nobody
Component: Uncategorized Version: dev
Severity: Normal Keywords:
Cc: 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 Baptiste Mispelon)

On Python 2.7 a template Origin can be both equal and not equal at the same time due to a missing __ne__ implementation.

>>> a = self.engine.get_template('index.html')
>>> b = self.engine.get_template('index.html')
>>> a.origin == b.origin
True
>>> a.origin != b.origin
True

Change History (7)

comment:1 by Baptiste Mispelon, 8 years ago

Description: modified (diff)
Triage Stage: UnreviewedAccepted

comment:2 by Simon Charette, 8 years ago

It looks like many objects in Django code base implement __eq__ but not __ne__.

  • django.template.base.Origin
  • django.template.context.BaseContext
  • django.core.validators.EmailValidator
  • django.core.validators.BaseValidator
  • django.core.validators.DecimalValidator
  • django.core.management.commands.makemessages.TranslatableFile
  • django.test.utils.Approximate
  • django.contrib.messages.storage.base.Message
  • django.contrib.gis.geos.mutable_list.ListMixin
  • django.contrib.gis.maps.google.overlays.GIcon
  • django.contrib.gis.gdal.feature.Feature
  • django.contrib.gis.gdal.envelope.Envelope
  • django.contrib.gis.measure.MeasureBase
  • django.contrib.gis.db.backends.postgis.adapter.PostGISAdapter
  • django.contrib.gis.db.backends.base.adapter.WKTAdapter
  • django.db.models.sql.datastructures.Join
  • django.db.models.query.Prefetch
  • django.db.models.fields.Field
  • django.db.migrations.utils.RegexObject
  • django.db.migrations.graph.Node

It might be worth fixing them too.

comment:3 by Jaap Roes, 8 years ago

I agree, those should be looked into. Will you file a separate ticket for those?

comment:4 by Simon Charette, 8 years ago

I don't think it's worth opening a new ticket for each instances. What about using this ticket for this purpose?

comment:5 by Jaap Roes, 8 years ago

I'd prefer opening one separate issue with the ones you listed so they can be fixed all at once. I don't see a reason to repurpose this issue, especially because it has a patch ready to go. Having the same issue elsewhere does not invalidate this specific ticket.

comment:6 by Tim Graham, 8 years ago

Given the amount of time that's passed without a report of a problem in those other cases and the relatively short amount of time that we'll drop Python 2 support, I don't see much advantage is proactively fixing those other places.

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

Resolution: fixed
Status: newclosed

In c6ea4ed5:

Fixed #25825 -- Implemented ne() for template Origin

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