Opened 10 years ago
Closed 10 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 )
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 , 10 years ago
| Description: | modified (diff) |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:2 by , 10 years ago
It looks like many objects in Django code base implement __eq__ but not __ne__.
django.template.base.Origindjango.template.context.BaseContextdjango.core.validators.EmailValidatordjango.core.validators.BaseValidatordjango.core.validators.DecimalValidatordjango.core.management.commands.makemessages.TranslatableFiledjango.test.utils.Approximatedjango.contrib.messages.storage.base.Messagedjango.contrib.gis.geos.mutable_list.ListMixindjango.contrib.gis.maps.google.overlays.GIcondjango.contrib.gis.gdal.feature.Featuredjango.contrib.gis.gdal.envelope.Envelopedjango.contrib.gis.measure.MeasureBasedjango.contrib.gis.db.backends.postgis.adapter.PostGISAdapterdjango.contrib.gis.db.backends.base.adapter.WKTAdapterdjango.db.models.sql.datastructures.Joindjango.db.models.query.Prefetchdjango.db.models.fields.Fielddjango.db.migrations.utils.RegexObjectdjango.db.migrations.graph.Node
It might be worth fixing them too.
comment:3 by , 10 years ago
I agree, those should be looked into. Will you file a separate ticket for those?
comment:4 by , 10 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 , 10 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 , 10 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.
PR here: https://github.com/django/django/pull/5736