Django GIS Measure refactor
|Reported by:||riccardodivirgilio||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||yes|
hi, the class MeasureBase in django.contrib.gis.measure is not subclassable.
i've write a new code, that allows the very same API, but it can be subclassed with no pain
the new code is one hundred line shorter, and is DRY.
in the old code the class Area and the class Distance write the same methods every time.
i've pushed a lot of base methods (like repr, init, sub, add, ...) in the base class, and i've defined just molt for the new Distance class and div for the new Area class.
Please consider to include this code in the django 1.4 version.
I've tested it and it works like the old version, but now you can create a new class for Weight with no method definition, just unit definition.
if you want i can write standard measure for every measure and we can put it inside localflavor...
Change History (20)
comment:1 Changed 3 years ago by riccardodivirgilio
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:3 Changed 3 years ago by lukeplant
- Patch needs improvement set
- Triage Stage changed from Unreviewed to Accepted
- Type changed from Uncategorized to Cleanup/optimization
comment:5 Changed 3 years ago by riccardodivirgilio
comment:7 Changed 3 years ago by riccardodivirgilio
comment:10 Changed 3 years ago by Claude Paroz <claude@…>
- Resolution set to fixed
- Status changed from new to closed