Django GIS Measure refactor
|Reported by:||Riccardo Di Virgilio||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 5 years ago by
|Patch needs improvement:||unset|
comment:3 Changed 5 years ago by
|Patch needs improvement:||set|
|Triage Stage:||Unreviewed → Accepted|
|Type:||Uncategorized → Cleanup/optimization|