> Refactoring Query.convert_values() into the backend operations would > remove some code duplication, and would also serve to keep all the > data coercion/typecasting code in a common location rather than > spreading some of it into the Query class. However, there are two > things that prevented me from doing this refactor. > ... > Secondly, contrib.GIS has a convert_values() function that invokes > super(GeoQuery, self).convert_values() in the case of an Oracle > spatial backend. Justin - is there any particular reason to call the > GeoQuery base class specifically, rather than invoking > self.connection.ops.convert_values()?
Yes, because your subset implementation of `convert_values` does not convert LOB values (which GeoQuery needs). Specifically, geometries are wrapped in a function that returns a CLOB, and the WKT string is obtained from a `.read()` call on the CLOB. I'm -1 on moving conversion operations from the Query class to the backend. However, I'd be +1 if Query.convert_values is kept -- even if it's just a wrapper around self.connection.ops.convert_values. If the conversion functions are _only_ available at the backend level, then it would mean I would have to create distinct spatial database backends every time I want to subclass the convert_values() method. I don't want to have to create distinct database backends just so I can override a single method (DATABASE_ENGINE='gis_postgresql_psycopg2' looks pretty awful to me). > Is GeoQuery likely to have a base class other than OracleQuery in the > Oracle case? No; unless, of course, the backend requires a custom Query class like Oracle does -- which would mean any future backends without LIMIT/ OFFSET and spatial support would also subclass from the backend's Query class. -Justin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---