Ticket #10839: geoquery_pickle_orcl.diff

File geoquery_pickle_orcl.diff, 1.4 KB (added by jbronn, 16 years ago)

Initial stab at this patch.

  • django/contrib/gis/db/models/sql/query.py

     
    3232        self.custom_select = {}
    3333        self.transformed_srid = None
    3434        self.extra_select_fields = {}
     35       
     36    if SpatialBackend.oracle:
     37        def __reduce__(self):
     38            if hasattr(GeoQuery, '__getstate__'):
     39                assert hasattr(GeoQuery, '__setstate__')
     40                data = self.__getstate__()
     41            else:
     42                data = self.__dict__
     43            return (unpickle_query_class, (GeoQuery,), data)
    3544
    3645    def clone(self, *args, **kwargs):
    3746        obj = super(GeoQuery, self).clone(*args, **kwargs)
     
    332341            # Otherwise, check by the given field name -- which may be
    333342            # a lookup to a _related_ geographic field.
    334343            return GeoWhereNode._check_geo_field(self.model._meta, field_name)
     344           
     345if SpatialBackend.oracle:
     346    def unpickle_query_class(QueryClass):
     347        """
     348        Utility function, called by Python's unpickling machinery, that handles
     349        unpickling of Oracle Query subclasses.
     350        """   
     351        return QueryClass.__new__(QueryClass)
     352    unpickle_query_class.__safe_for_unpickling__ = True
Back to Top